home *** CD-ROM | disk | FTP | other *** search
MacBinary | 1996-09-25 | 38.0 KB | [TEXT/MPS ] |
open in:
MacOS 8.1
|
Win98
|
DOS
browse contents |
view JSON data
|
view as text
This file was processed as: MacBinary
(archive/macBinary).
id metadata |
---|
key | value |
---|
macFileType | [TEXT] |
macFileCreator | [MPS ] |
hex view+--------+-------------------------+-------------------------+--------+--------+
|00000000| 00 04 69 6f 2e 63 00 00 | 00 00 00 00 00 00 00 00 |..io.c..|........|
|00000010| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000020| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000030| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000040| 00 54 45 58 54 4d 50 53 | 20 01 00 00 00 00 00 00 |.TEXTMPS| .......|
|00000050| 00 00 00 00 00 95 6b 00 | 00 01 ac ae 6f 0a a4 ae |......k.|....o...|
|00000060| 6f 0a a4 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |o.......|........|
|00000070| 00 00 00 00 00 00 00 00 | 00 00 81 81 8d d9 00 00 |........|........|
|00000080| 2f 2a 20 46 69 6c 65 20 | 49 2f 4f 20 66 6f 72 20 |/* File |I/O for |
|00000090| 45 63 6c 65 63 74 75 73 | 20 69 6e 74 65 67 72 61 |Eclectus| integra|
|000000a0| 74 69 6f 6e 20 75 74 69 | 6c 69 74 69 65 73 2e 0d |tion uti|lities..|
|000000b0| 09 20 43 6f 70 79 72 69 | 67 68 74 20 28 43 29 20 |. Copyri|ght (C) |
|000000c0| 31 39 39 32 2d 31 39 39 | 36 20 45 63 6c 65 63 74 |1992-199|6 Eclect|
|000000d0| 75 73 20 28 44 2e 20 4a | 6f 68 6e 20 41 6e 64 65 |us (D. J|ohn Ande|
|000000e0| 72 73 6f 6e 2c 20 41 6c | 61 6e 20 42 2e 20 48 61 |rson, Al|an B. Ha|
|000000f0| 72 70 65 72 29 2e 0d 0d | 54 68 69 73 20 66 69 6c |rper)...|This fil|
|00000100| 65 20 69 73 20 70 61 72 | 74 20 6f 66 20 74 68 65 |e is par|t of the|
|00000110| 20 45 63 6c 65 63 74 75 | 73 20 69 6e 74 65 67 72 | Eclectu|s integr|
|00000120| 61 74 69 6f 6e 20 75 74 | 69 6c 69 74 69 65 73 2e |ation ut|ilities.|
|00000130| 0d 0d 45 63 6c 65 63 74 | 75 73 20 69 6e 74 65 67 |..Eclect|us integ|
|00000140| 72 61 74 69 6f 6e 20 75 | 74 69 6c 69 74 69 65 73 |ration u|tilities|
|00000150| 20 61 72 65 20 66 72 65 | 65 20 73 6f 66 74 77 61 | are fre|e softwa|
|00000160| 72 65 3b 20 79 6f 75 20 | 63 61 6e 20 72 65 64 69 |re; you |can redi|
|00000170| 73 74 72 69 62 75 74 65 | 0d 69 74 20 61 6e 64 2f |stribute|.it and/|
|00000180| 6f 72 20 6d 6f 64 69 66 | 79 20 69 74 20 75 6e 64 |or modif|y it und|
|00000190| 65 72 20 74 68 65 20 74 | 65 72 6d 73 20 6f 66 20 |er the t|erms of |
|000001a0| 74 68 65 20 47 4e 55 20 | 47 65 6e 65 72 61 6c 20 |the GNU |General |
|000001b0| 50 75 62 6c 69 63 20 4c | 69 63 65 6e 73 65 0d 61 |Public L|icense.a|
|000001c0| 73 20 70 75 62 6c 69 73 | 68 65 64 20 62 79 20 74 |s publis|hed by t|
|000001d0| 68 65 20 46 72 65 65 20 | 53 6f 66 74 77 61 72 65 |he Free |Software|
|000001e0| 20 46 6f 75 6e 64 61 74 | 69 6f 6e 3b 20 65 69 74 | Foundat|ion; eit|
|000001f0| 68 65 72 20 76 65 72 73 | 69 6f 6e 20 31 2c 20 6f |her vers|ion 1, o|
|00000200| 72 0d 28 61 74 20 79 6f | 75 72 20 6f 70 74 69 6f |r.(at yo|ur optio|
|00000210| 6e 29 20 61 6e 79 20 6c | 61 74 65 72 20 76 65 72 |n) any l|ater ver|
|00000220| 73 69 6f 6e 2e 0d 0d 45 | 63 6c 65 63 74 75 73 20 |sion...E|clectus |
|00000230| 69 6e 74 65 67 72 61 74 | 69 6f 6e 20 75 74 69 6c |integrat|ion util|
|00000240| 69 74 69 65 73 20 69 73 | 20 64 69 73 74 72 69 62 |ities is| distrib|
|00000250| 75 74 65 64 20 69 6e 20 | 74 68 65 20 68 6f 70 65 |uted in |the hope|
|00000260| 20 74 68 61 74 20 69 74 | 0d 77 69 6c 6c 20 62 65 | that it|.will be|
|00000270| 20 75 73 65 66 75 6c 2c | 20 62 75 74 20 57 49 54 | useful,| but WIT|
|00000280| 48 4f 55 54 20 41 4e 59 | 20 57 41 52 52 41 4e 54 |HOUT ANY| WARRANT|
|00000290| 59 3b 20 77 69 74 68 6f | 75 74 20 65 76 65 6e 20 |Y; witho|ut even |
|000002a0| 74 68 65 20 69 6d 70 6c | 69 65 64 0d 77 61 72 72 |the impl|ied.warr|
|000002b0| 61 6e 74 79 20 6f 66 20 | 4d 45 52 43 48 41 4e 54 |anty of |MERCHANT|
|000002c0| 41 42 49 4c 49 54 59 20 | 6f 72 20 46 49 54 4e 45 |ABILITY |or FITNE|
|000002d0| 53 53 20 46 4f 52 20 41 | 20 50 41 52 54 49 43 55 |SS FOR A| PARTICU|
|000002e0| 4c 41 52 20 50 55 52 50 | 4f 53 45 2e 0d 53 65 65 |LAR PURP|OSE..See|
|000002f0| 20 74 68 65 20 47 4e 55 | 20 47 65 6e 65 72 61 6c | the GNU| General|
|00000300| 20 50 75 62 6c 69 63 20 | 4c 69 63 65 6e 73 65 20 | Public |License |
|00000310| 66 6f 72 20 6d 6f 72 65 | 20 64 65 74 61 69 6c 73 |for more| details|
|00000320| 2e 0d 0d 59 6f 75 20 73 | 68 6f 75 6c 64 20 68 61 |...You s|hould ha|
|00000330| 76 65 20 72 65 63 65 69 | 76 65 64 20 61 20 63 6f |ve recei|ved a co|
|00000340| 70 79 20 6f 66 20 74 68 | 65 20 47 4e 55 20 47 65 |py of th|e GNU Ge|
|00000350| 6e 65 72 61 6c 20 50 75 | 62 6c 69 63 20 4c 69 63 |neral Pu|blic Lic|
|00000360| 65 6e 73 65 0d 61 6c 6f | 6e 67 20 77 69 74 68 20 |ense.alo|ng with |
|00000370| 74 68 65 20 45 63 6c 65 | 63 74 75 73 20 69 6e 74 |the Ecle|ctus int|
|00000380| 65 67 72 61 74 69 6f 6e | 20 75 74 69 6c 69 74 69 |egration| utiliti|
|00000390| 65 73 3b 20 73 65 65 20 | 74 68 65 20 66 69 6c 65 |es; see |the file|
|000003a0| 20 43 4f 50 59 49 4e 47 | 2e 0d 49 66 20 6e 6f 74 | COPYING|..If not|
|000003b0| 2c 20 77 72 69 74 65 20 | 74 6f 20 74 68 65 20 46 |, write |to the F|
|000003c0| 72 65 65 20 53 6f 66 74 | 77 61 72 65 20 46 6f 75 |ree Soft|ware Fou|
|000003d0| 6e 64 61 74 69 6f 6e 2c | 20 36 37 35 20 4d 61 73 |ndation,| 675 Mas|
|000003e0| 73 20 41 76 65 2c 20 43 | 61 6d 62 72 69 64 67 65 |s Ave, C|ambridge|
|000003f0| 2c 0d 4d 41 20 30 32 31 | 33 39 2c 20 55 53 41 2e |,.MA 021|39, USA.|
|00000400| 09 2a 2f 0d 0d 23 69 6e | 63 6c 75 64 65 20 22 64 |.*/..#in|clude "d|
|00000410| 69 66 66 2e 68 22 0d 23 | 69 6e 63 6c 75 64 65 20 |iff.h".#|include |
|00000420| 3c 63 74 79 70 65 2e 68 | 3e 0d 23 69 6e 63 6c 75 |<ctype.h|>.#inclu|
|00000430| 64 65 20 3c 73 74 72 69 | 6e 67 2e 68 3e 0d 23 69 |de <stri|ng.h>.#i|
|00000440| 6e 63 6c 75 64 65 20 3c | 73 74 64 64 65 66 2e 68 |nclude <|stddef.h|
|00000450| 3e 0d 23 69 6e 63 6c 75 | 64 65 20 3c 73 74 64 6c |>.#inclu|de <stdl|
|00000460| 69 62 2e 68 3e 0d 0d 23 | 69 66 64 65 66 20 44 46 |ib.h>..#|ifdef DF|
|00000470| 5f 4d 41 43 48 49 4e 45 | 5f 4d 41 43 49 4e 54 4f |_MACHINE|_MACINTO|
|00000480| 53 48 0d 09 23 69 6e 63 | 6c 75 64 65 20 3c 45 72 |SH..#inc|lude <Er|
|00000490| 72 6f 72 73 2e 68 3e 0d | 09 23 69 6e 63 6c 75 64 |rors.h>.|.#includ|
|000004a0| 65 20 3c 46 69 6c 65 73 | 2e 68 3e 0d 09 23 69 6e |e <Files|.h>..#in|
|000004b0| 63 6c 75 64 65 20 3c 43 | 75 72 73 6f 72 43 74 6c |clude <C|ursorCtl|
|000004c0| 2e 68 3e 0d 23 65 6e 64 | 69 66 0d 0d 23 69 66 64 |.h>.#end|if..#ifd|
|000004d0| 65 66 20 44 46 5f 4d 41 | 43 48 49 4e 45 5f 57 49 |ef DF_MA|CHINE_WI|
|000004e0| 4e 44 4f 57 53 0d 09 23 | 64 65 66 69 6e 65 20 57 |NDOWS..#|define W|
|000004f0| 49 4e 33 32 5f 4c 45 41 | 4e 5f 41 4e 44 5f 4d 45 |IN32_LEA|N_AND_ME|
|00000500| 41 4e 0d 09 23 69 6e 63 | 6c 75 64 65 20 3c 57 69 |AN..#inc|lude <Wi|
|00000510| 6e 64 6f 77 73 2e 68 3e | 0d 23 65 6e 64 69 66 0d |ndows.h>|.#endif.|
|00000520| 0d 23 69 66 64 65 66 20 | 44 46 5f 4d 41 43 48 49 |.#ifdef |DF_MACHI|
|00000530| 4e 45 5f 4e 45 58 54 0d | 09 23 69 6e 63 6c 75 64 |NE_NEXT.|.#includ|
|00000540| 65 20 3c 73 79 73 2f 74 | 79 70 65 73 2e 68 3e 0d |e <sys/t|ypes.h>.|
|00000550| 09 23 69 6e 63 6c 75 64 | 65 20 3c 73 79 73 2f 64 |.#includ|e <sys/d|
|00000560| 69 72 2e 68 3e 0d 09 23 | 69 6e 63 6c 75 64 65 20 |ir.h>..#|include |
|00000570| 3c 73 79 73 2f 73 74 61 | 74 2e 68 3e 0d 09 23 69 |<sys/sta|t.h>..#i|
|00000580| 6e 63 6c 75 64 65 20 3c | 73 79 73 2f 74 69 6d 65 |nclude <|sys/time|
|00000590| 2e 68 3e 0d 20 2f 2a 0d | 09 2a 20 54 68 65 73 65 |.h>. /*.|.* These|
|000005a0| 20 64 65 66 69 6e 65 73 | 20 61 72 65 20 6e 6f 72 | defines| are nor|
|000005b0| 6d 61 6c 6c 79 20 69 6e | 20 6c 69 62 63 2e 68 2e |mally in| libc.h.|
|000005c0| 20 20 48 6f 77 65 76 65 | 72 2c 20 6c 69 62 63 2e | Howeve|r, libc.|
|000005d0| 68 20 77 6f 6e 27 74 20 | 63 6f 6d 70 69 6c 65 20 |h won't |compile |
|000005e0| 63 6f 72 72 65 63 74 6c | 79 0d 09 2a 20 77 68 65 |correctl|y..* whe|
|000005f0| 6e 20 74 68 65 20 61 6e | 73 69 20 66 6c 61 67 20 |n the an|si flag |
|00000600| 69 73 20 6f 6e 20 61 6e | 64 20 74 68 65 72 65 20 |is on an|d there |
|00000610| 61 72 65 20 74 6f 6f 20 | 6d 61 6e 79 20 70 72 6f |are too |many pro|
|00000620| 62 6c 65 6d 73 20 74 6f | 20 66 69 78 20 73 6f 20 |blems to| fix so |
|00000630| 77 65 27 6c 6c 20 6a 75 | 73 74 20 64 65 63 6c 61 |we'll ju|st decla|
|00000640| 72 65 0d 09 2a 20 74 68 | 65 73 65 20 69 74 65 6d |re..* th|ese item|
|00000650| 73 20 68 65 72 65 2e 0d | 09 2a 2f 0d 09 65 78 74 |s here..|.*/..ext|
|00000660| 65 72 6e 20 69 6e 74 09 | 6d 6b 64 69 72 28 63 6f |ern int.|mkdir(co|
|00000670| 6e 73 74 20 63 68 61 72 | 20 2a 2c 20 69 6e 74 29 |nst char| *, int)|
|00000680| 3b 0d 09 65 78 74 65 72 | 6e 20 69 6e 74 09 63 68 |;..exter|n int.ch|
|00000690| 6d 6f 64 28 63 6f 6e 73 | 74 20 63 68 61 72 20 2a |mod(cons|t char *|
|000006a0| 2c 20 69 6e 74 29 3b 20 | 0d 23 65 6e 64 69 66 0d |, int); |.#endif.|
|000006b0| 0d 20 2f 2a 0d 09 2a 20 | 59 6f 75 20 63 61 6e 20 |. /*..* |You can |
|000006c0| 6d 6f 64 69 66 79 20 74 | 68 69 73 20 6c 69 73 74 |modify t|his list|
|000006d0| 20 6f 66 20 65 78 74 65 | 6e 73 69 6f 6e 73 20 74 | of exte|nsions t|
|000006e0| 6f 20 73 70 65 63 69 66 | 79 20 77 68 69 63 68 20 |o specif|y which |
|000006f0| 66 69 6c 65 73 20 61 72 | 65 20 62 69 6e 61 72 79 |files ar|e binary|
|00000700| 20 6f 6e 20 6d 61 63 68 | 69 6e 65 73 0d 09 2a 20 | on mach|ines..* |
|00000710| 6f 74 68 65 72 20 74 68 | 61 6e 20 4d 61 63 69 6e |other th|an Macin|
|00000720| 74 6f 73 68 20 4f 53 2e | 20 20 4d 61 63 69 6e 74 |tosh OS.| Macint|
|00000730| 6f 73 68 20 73 74 6f 72 | 65 73 20 61 74 74 72 69 |osh stor|es attri|
|00000740| 62 75 74 65 73 20 77 69 | 74 68 20 61 20 66 69 6c |butes wi|th a fil|
|00000750| 65 20 77 68 69 63 68 20 | 69 6e 64 69 63 61 74 65 |e which |indicate|
|00000760| 0d 09 2a 20 62 69 6e 61 | 72 79 20 66 69 6c 65 73 |..* bina|ry files|
|00000770| 2e 0d 20 20 2a 0d 09 2a | 20 59 6f 75 20 63 61 6e |.. *..*| You can|
|00000780| 20 61 6c 73 6f 20 73 70 | 65 63 69 66 79 20 65 78 | also sp|ecify ex|
|00000790| 74 65 6e 73 69 6f 6e 73 | 20 74 6f 20 69 67 6e 6f |tensions| to igno|
|000007a0| 72 65 2e 0d 09 2a 0d 09 | 2a 20 54 68 65 20 70 72 |re...*..|* The pr|
|000007b0| 6f 67 72 61 6d 20 77 69 | 6c 6c 20 74 72 65 61 74 |ogram wi|ll treat|
|000007c0| 20 74 68 65 20 63 61 73 | 65 20 6f 66 20 65 78 74 | the cas|e of ext|
|000007d0| 65 6e 73 69 6f 6e 73 20 | 61 73 20 69 6e 73 69 67 |ensions |as insig|
|000007e0| 6e 69 66 69 63 61 6e 74 | 2e 0d 09 2a 0d 09 2a 20 |nificant|...*..* |
|000007f0| 4e 6f 74 65 3a 20 52 65 | 6d 65 6d 62 65 72 20 74 |Note: Re|member t|
|00000800| 6f 20 75 70 64 61 74 65 | 20 4d 41 58 5f 45 58 54 |o update| MAX_EXT|
|00000810| 45 4e 53 49 4f 4e 5f 4c | 45 4e 47 54 48 20 74 6f |ENSION_L|ENGTH to|
|00000820| 20 72 65 66 6c 65 63 74 | 20 74 68 65 20 6c 6f 6e | reflect| the lon|
|00000830| 67 65 73 74 20 65 78 74 | 65 6e 73 69 6f 6e 20 69 |gest ext|ension i|
|00000840| 6e 20 62 6f 74 68 0d 09 | 2a 20 62 6f 74 68 20 6c |n both..|* both l|
|00000850| 69 73 74 73 2e 20 20 59 | 6f 75 20 6d 75 73 74 20 |ists. Y|ou must |
|00000860| 65 6e 74 65 72 20 74 68 | 65 73 65 20 65 78 74 65 |enter th|ese exte|
|00000870| 6e 73 69 6f 6e 20 69 6e | 20 6c 6f 77 65 72 20 63 |nsion in| lower c|
|00000880| 61 73 65 2e 20 20 54 68 | 65 20 6c 61 73 74 20 65 |ase. Th|e last e|
|00000890| 78 74 65 6e 73 69 6f 6e | 20 6d 75 73 74 0d 09 2a |xtension| must..*|
|000008a0| 20 62 65 20 74 68 65 20 | 65 6d 70 74 79 20 73 74 | be the |empty st|
|000008b0| 72 69 6e 67 0d 09 2a 2f | 0d 0d 23 64 65 66 69 6e |ring..*/|..#defin|
|000008c0| 65 20 4d 41 58 5f 45 58 | 54 45 4e 53 49 4f 4e 5f |e MAX_EX|TENSION_|
|000008d0| 4c 45 4e 47 54 48 20 33 | 0d 0d 23 69 66 6e 64 65 |LENGTH 3|..#ifnde|
|000008e0| 66 20 44 46 5f 4d 41 43 | 48 49 4e 45 5f 4d 41 43 |f DF_MAC|HINE_MAC|
|000008f0| 49 4e 54 4f 53 48 0d 09 | 73 74 61 74 69 63 20 63 |INTOSH..|static c|
|00000900| 68 61 72 09 20 2a 62 69 | 6e 61 72 79 45 78 74 65 |har. *bi|naryExte|
|00000910| 6e 73 69 6f 6e 73 20 5b | 5d 20 3d 20 7b 0d 09 09 |nsions [|] = {...|
|00000920| 22 61 70 73 22 2c 0d 09 | 09 22 62 6d 70 22 2c 0d |"aps",..|."bmp",.|
|00000930| 09 09 22 62 73 63 22 2c | 0d 09 09 22 64 6c 6c 22 |.."bsc",|..."dll"|
|00000940| 2c 0d 09 09 22 65 78 65 | 22 2c 0d 09 09 22 68 6c |,..."exe|",..."hl|
|00000950| 70 22 2c 0d 09 09 22 69 | 63 6f 22 2c 0d 09 09 22 |p",..."i|co",..."|
|00000960| 69 6e 6b 22 2c 0d 09 09 | 22 6c 69 62 22 2c 0d 09 |ink",...|"lib",..|
|00000970| 09 22 6d 64 70 22 2c 0d | 09 09 22 6d 70 77 22 2c |."mdp",.|.."mpw",|
|00000980| 0d 09 09 22 6d 77 6b 22 | 2c 0d 09 09 22 6e 63 62 |..."mwk"|,..."ncb|
|00000990| 22 2c 0d 09 09 22 6f 62 | 6a 22 2c 0d 09 09 22 6f |",..."ob|j",..."o|
|000009a0| 73 22 2c 0d 09 09 22 6f | 73 78 22 2c 0d 09 09 22 |s",..."o|sx",..."|
|000009b0| 70 63 68 22 2c 0d 09 09 | 22 70 64 62 22 2c 0d 09 |pch",...|"pdb",..|
|000009c0| 09 22 70 72 6a 22 2c 0d | 09 09 22 72 65 73 22 2c |."prj",.|.."res",|
|000009d0| 0d 09 09 22 73 62 72 22 | 2c 0d 09 09 22 73 63 72 |..."sbr"|,..."scr|
|000009e0| 22 2c 0d 09 09 22 76 63 | 70 22 2c 0d 09 09 22 77 |",..."vc|p",..."w|
|000009f0| 72 69 22 2c 0d 09 09 22 | 38 62 66 22 2c 0d 09 09 |ri",..."|8bf",...|
|00000a00| 22 22 0d 09 7d 3b 0d 23 | 65 6e 64 69 66 0d 0d 73 |""..};.#|endif..s|
|00000a10| 74 61 74 69 63 20 63 68 | 61 72 09 20 2a 69 67 6e |tatic ch|ar. *ign|
|00000a20| 6f 72 65 45 78 74 65 6e | 73 69 6f 6e 73 20 5b 5d |oreExten|sions []|
|00000a30| 20 3d 20 7b 0d 09 22 69 | 22 2c 0d 09 22 69 64 62 | = {.."i|",.."idb|
|00000a40| 22 2c 20 2f 2a 20 4d 53 | 56 43 20 34 2e 30 20 69 |", /* MS|VC 4.0 i|
|00000a50| 6e 74 65 72 6d 65 64 69 | 61 74 65 20 66 69 6c 65 |ntermedi|ate file|
|00000a60| 20 2a 2f 0d 09 22 69 6c | 6b 22 2c 20 2f 2a 20 4d | */.."il|k", /* M|
|00000a70| 53 56 43 20 69 6e 74 65 | 72 6d 65 64 69 61 74 65 |SVC inte|rmediate|
|00000a80| 20 6c 69 6e 6b 20 66 69 | 6c 65 20 2a 2f 0d 09 22 | link fi|le */.."|
|00000a90| 6e 63 62 22 2c 20 2f 2a | 20 4d 53 56 43 20 34 2e |ncb", /*| MSVC 4.|
|00000aa0| 30 20 62 69 6e 61 72 79 | 20 70 72 6f 6a 65 63 74 |0 binary| project|
|00000ab0| 20 66 69 6c 65 20 63 61 | 63 68 65 20 2a 2f 0d 09 | file ca|che */..|
|00000ac0| 22 6f 62 6a 22 2c 20 2f | 2a 20 4d 53 56 43 20 4f |"obj", /|* MSVC O|
|00000ad0| 62 6a 65 63 74 20 66 69 | 6c 65 73 20 2a 2f 0d 09 |bject fi|les */..|
|00000ae0| 22 70 63 68 22 2c 20 2f | 2a 20 4d 53 56 43 20 70 |"pch", /|* MSVC p|
|00000af0| 72 65 63 6f 6d 70 69 6c | 65 64 20 68 65 61 64 65 |recompil|ed heade|
|00000b00| 72 20 66 69 6c 65 73 20 | 2a 2f 0d 09 22 70 64 62 |r files |*/.."pdb|
|00000b10| 22 2c 20 2f 2a 20 4d 53 | 56 43 20 70 72 6f 67 72 |", /* MS|VC progr|
|00000b20| 61 6d 20 64 61 74 61 62 | 61 73 65 20 2a 2f 0d 09 |am datab|ase */..|
|00000b30| 22 74 6d 70 22 2c 20 2f | 2a 20 4d 53 56 43 20 74 |"tmp", /|* MSVC t|
|00000b40| 65 6d 70 6f 72 61 72 79 | 20 66 69 6c 65 20 2a 2f |emporary| file */|
|00000b50| 0d 09 22 22 0d 7d 3b 0d | 0d 2f 2a 20 4c 69 6e 65 |.."".};.|./* Line|
|00000b60| 73 20 61 72 65 20 70 75 | 74 20 69 6e 74 6f 20 65 |s are pu|t into e|
|00000b70| 71 75 69 76 61 6c 65 6e | 63 65 20 63 6c 61 73 73 |quivalen|ce class|
|00000b80| 65 73 20 28 6f 66 20 6c | 69 6e 65 73 20 74 68 61 |es (of l|ines tha|
|00000b90| 74 20 6d 61 74 63 68 20 | 69 6e 20 6c 69 6e 65 5f |t match |in line_|
|00000ba0| 63 6d 70 29 2e 0d 09 20 | 45 61 63 68 20 65 71 75 |cmp)... |Each equ|
|00000bb0| 69 76 61 6c 65 6e 63 65 | 20 63 6c 61 73 73 20 69 |ivalence| class i|
|00000bc0| 73 20 72 65 70 72 65 73 | 65 6e 74 65 64 20 62 79 |s repres|ented by|
|00000bd0| 20 6f 6e 65 20 6f 66 20 | 74 68 65 73 65 20 73 74 | one of |these st|
|00000be0| 72 75 63 74 75 72 65 73 | 2c 0d 09 20 62 75 74 20 |ructures|,.. but |
|00000bf0| 6f 6e 6c 79 20 77 68 69 | 6c 65 20 74 68 65 20 63 |only whi|le the c|
|00000c00| 6c 61 73 73 65 73 20 61 | 72 65 20 62 65 69 6e 67 |lasses a|re being|
|00000c10| 20 63 6f 6d 70 75 74 65 | 64 2e 09 0d 09 20 41 66 | compute|d.... Af|
|00000c20| 74 65 72 77 61 72 64 2c | 20 65 61 63 68 20 63 6c |terward,| each cl|
|00000c30| 61 73 73 20 69 73 20 72 | 65 70 72 65 73 65 6e 74 |ass is r|epresent|
|00000c40| 65 64 20 62 79 20 61 20 | 6e 75 6d 62 65 72 2e 09 |ed by a |number..|
|00000c50| 2a 2f 0d 73 74 72 75 63 | 74 20 65 71 75 69 76 63 |*/.struc|t equivc|
|00000c60| 6c 61 73 73 0d 7b 0d 09 | 73 74 72 75 63 74 20 65 |lass.{..|struct e|
|00000c70| 71 75 69 76 63 6c 61 73 | 73 20 2a 6e 65 78 74 3b |quivclas|s *next;|
|00000c80| 09 09 09 2f 2a 20 4e 65 | 78 74 20 69 74 65 6d 20 |.../* Ne|xt item |
|00000c90| 69 6e 20 74 68 69 73 20 | 62 75 63 6b 65 74 2e 20 |in this |bucket. |
|00000ca0| 2a 2f 0d 09 73 74 72 75 | 63 74 20 6c 69 6e 65 5f |*/..stru|ct line_|
|00000cb0| 64 65 66 20 6c 69 6e 65 | 3b 20 2f 2a 20 41 20 6c |def line|; /* A l|
|00000cc0| 69 6e 65 20 74 68 61 74 | 20 66 69 74 73 20 74 68 |ine that| fits th|
|00000cd0| 69 73 20 63 6c 61 73 73 | 2e 20 2a 2f 0d 7d 3b 0d |is class|. */.};.|
|00000ce0| 0d 2f 2a 20 48 61 73 68 | 2d 74 61 62 6c 65 3a 20 |./* Hash|-table: |
|00000cf0| 61 72 72 61 79 20 6f 66 | 20 62 75 63 6b 65 74 73 |array of| buckets|
|00000d00| 2c 20 65 61 63 68 20 62 | 65 69 6e 67 20 61 20 63 |, each b|eing a c|
|00000d10| 68 61 69 6e 20 6f 66 20 | 65 71 75 69 76 61 6c 65 |hain of |equivale|
|00000d20| 6e 63 65 20 63 6c 61 73 | 73 65 73 2e 20 20 2a 2f |nce clas|ses. */|
|00000d30| 0d 73 74 61 74 69 63 20 | 73 74 72 75 63 74 20 65 |.static |struct e|
|00000d40| 71 75 69 76 63 6c 61 73 | 73 20 2a 2a 62 75 63 6b |quivclas|s **buck|
|00000d50| 65 74 73 3b 0d 09 0d 2f | 2a 20 53 69 7a 65 20 6f |ets;.../|* Size o|
|00000d60| 66 20 74 68 65 20 62 75 | 63 6b 65 74 20 61 72 72 |f the bu|cket arr|
|00000d70| 61 79 2e 20 2a 2f 0d 73 | 74 61 74 69 63 20 69 6e |ay. */.s|tatic in|
|00000d80| 74 20 6e 62 75 63 6b 65 | 74 73 3b 0d 0d 2f 2a 20 |t nbucke|ts;../* |
|00000d90| 41 72 72 61 79 20 69 6e | 20 77 68 69 63 68 20 74 |Array in| which t|
|00000da0| 68 65 20 65 71 75 69 76 | 61 6c 65 6e 63 65 20 63 |he equiv|alence c|
|00000db0| 6c 61 73 73 65 73 20 61 | 72 65 20 61 6c 6c 6f 63 |lasses a|re alloc|
|00000dc0| 61 74 65 64 2e 0d 09 20 | 54 68 65 20 62 75 63 6b |ated... |The buck|
|00000dd0| 65 74 2d 63 68 61 69 6e | 73 20 67 6f 20 74 68 72 |et-chain|s go thr|
|00000de0| 6f 75 67 68 20 74 68 65 | 20 65 6c 65 6d 65 6e 74 |ough the| element|
|00000df0| 73 20 69 6e 20 74 68 69 | 73 20 61 72 72 61 79 2e |s in thi|s array.|
|00000e00| 0d 09 20 54 68 65 20 6e | 75 6d 62 65 72 20 6f 66 |.. The n|umber of|
|00000e10| 20 61 6e 20 65 71 75 69 | 76 61 6c 65 6e 63 65 20 | an equi|valence |
|00000e20| 63 6c 61 73 73 20 69 73 | 20 69 74 73 20 69 6e 64 |class is| its ind|
|00000e30| 65 78 20 69 6e 20 74 68 | 69 73 20 61 72 72 61 79 |ex in th|is array|
|00000e40| 2e 20 20 2a 2f 0d 73 74 | 61 74 69 63 20 73 74 72 |. */.st|atic str|
|00000e50| 75 63 74 20 65 71 75 69 | 76 63 6c 61 73 73 20 2a |uct equi|vclass *|
|00000e60| 65 71 75 69 76 73 3b 0d | 0d 2f 2a 20 49 6e 64 65 |equivs;.|./* Inde|
|00000e70| 78 20 6f 66 20 66 69 72 | 73 74 20 66 72 65 65 20 |x of fir|st free |
|00000e80| 65 6c 65 6d 65 6e 74 20 | 69 6e 20 74 68 65 20 61 |element |in the a|
|00000e90| 72 72 61 79 20 60 65 71 | 75 69 76 73 27 2e 20 20 |rray `eq|uivs'. |
|00000ea0| 2a 2f 0d 73 74 61 74 69 | 63 20 69 6e 74 20 65 71 |*/.stati|c int eq|
|00000eb0| 75 69 76 73 5f 69 6e 64 | 65 78 3b 0d 0d 2f 2a 20 |uivs_ind|ex;../* |
|00000ec0| 4c 61 72 67 65 73 74 20 | 70 72 69 6d 65 73 20 6c |Largest |primes l|
|00000ed0| 65 73 73 20 74 68 61 6e | 20 73 6f 6d 65 20 70 6f |ess than| some po|
|00000ee0| 77 65 72 20 6f 66 20 74 | 77 6f 2c 20 66 6f 72 20 |wer of t|wo, for |
|00000ef0| 6e 62 75 63 6b 65 74 73 | 2e 09 56 61 6c 75 65 73 |nbuckets|..Values|
|00000f00| 20 72 61 6e 67 65 0d 09 | 20 66 72 6f 6d 20 75 73 | range..| from us|
|00000f10| 65 66 75 6c 20 74 6f 20 | 70 72 65 70 6f 73 74 65 |eful to |preposte|
|00000f20| 72 6f 75 73 2e 20 20 49 | 66 20 6f 6e 65 20 6f 66 |rous. I|f one of|
|00000f30| 20 74 68 65 73 65 20 6e | 75 6d 62 65 72 73 20 69 | these n|umbers i|
|00000f40| 73 6e 27 74 20 70 72 69 | 6d 65 0d 09 20 61 66 74 |sn't pri|me.. aft|
|00000f50| 65 72 20 61 6c 6c 2c 20 | 64 6f 6e 27 74 20 62 6c |er all, |don't bl|
|00000f60| 61 6d 65 20 69 74 20 6f | 6e 20 6d 65 2c 20 62 6c |ame it o|n me, bl|
|00000f70| 61 6d 65 20 69 74 20 6f | 6e 20 70 72 69 6d 65 73 |ame it o|n primes|
|00000f80| 20 28 36 29 20 2e 20 2e | 20 2e 20 2a 2f 0d 73 74 | (6) . .| . */.st|
|00000f90| 61 74 69 63 20 69 6e 74 | 20 70 72 69 6d 65 73 5b |atic int| primes[|
|00000fa0| 5d 20 3d 0d 7b 0d 09 35 | 30 39 2c 0d 09 31 30 32 |] =.{..5|09,..102|
|00000fb0| 31 2c 0d 09 32 30 33 39 | 2c 0d 09 34 30 39 33 2c |1,..2039|,..4093,|
|00000fc0| 0d 09 38 31 39 31 2c 0d | 09 31 36 33 38 31 2c 0d |..8191,.|.16381,.|
|00000fd0| 09 33 32 37 34 39 2c 0d | 09 36 35 35 32 31 2c 0d |.32749,.|.65521,.|
|00000fe0| 09 31 33 31 30 37 31 2c | 0d 09 32 36 32 31 33 39 |.131071,|..262139|
|00000ff0| 2c 0d 09 35 32 34 32 38 | 37 2c 0d 09 31 30 34 38 |,..52428|7,..1048|
|00001000| 35 37 33 2c 0d 09 32 30 | 39 37 31 34 33 2c 0d 09 |573,..20|97143,..|
|00001010| 34 31 39 34 33 30 31 2c | 0d 09 38 33 38 38 35 39 |4194301,|..838859|
|00001020| 33 2c 0d 09 31 36 37 37 | 37 32 31 33 2c 0d 09 33 |3,..1677|7213,..3|
|00001030| 33 35 35 34 33 39 33 2c | 0d 09 36 37 31 30 38 38 |3554393,|..671088|
|00001040| 35 39 2c 20 09 09 09 09 | 09 09 09 09 09 09 2f 2a |59, ....|....../*|
|00001050| 20 50 72 65 70 6f 73 74 | 65 72 6f 75 73 6c 79 20 | Prepost|erously |
|00001060| 6c 61 72 67 65 20 2e 20 | 2e 20 2e 20 2a 2f 0d 09 |large . |. . */..|
|00001070| 2d 31 0d 7d 3b 0d 0d 73 | 74 61 74 69 63 20 76 6f |-1.};..s|tatic vo|
|00001080| 69 64 20 09 09 66 69 6e | 64 5f 61 6e 64 5f 68 61 |id ..fin|d_and_ha|
|00001090| 73 68 5f 65 61 63 68 5f | 6c 69 6e 65 20 28 72 65 |sh_each_|line (re|
|000010a0| 67 69 73 74 65 72 20 73 | 74 72 75 63 74 20 66 69 |gister s|truct fi|
|000010b0| 6c 65 5f 64 61 74 61 20 | 2a 66 69 6c 65 50 74 72 |le_data |*filePtr|
|000010c0| 29 3b 0d 73 74 61 74 69 | 63 20 76 6f 69 64 20 09 |);.stati|c void .|
|000010d0| 09 66 69 6e 64 5f 65 71 | 75 69 76 5f 63 6c 61 73 |.find_eq|uiv_clas|
|000010e0| 73 20 28 72 65 67 69 73 | 74 65 72 20 73 74 72 75 |s (regis|ter stru|
|000010f0| 63 74 20 66 69 6c 65 5f | 64 61 74 61 20 2a 66 69 |ct file_|data *fi|
|00001100| 6c 65 50 74 72 29 3b 0d | 73 74 61 74 69 63 20 76 |lePtr);.|static v|
|00001110| 6f 69 64 20 09 09 66 69 | 6e 64 5f 69 64 65 6e 74 |oid ..fi|nd_ident|
|00001120| 69 63 61 6c 5f 65 6e 64 | 73 20 28 72 65 67 69 73 |ical_end|s (regis|
|00001130| 74 65 72 20 73 74 72 75 | 63 74 20 66 69 6c 65 5f |ter stru|ct file_|
|00001140| 64 61 74 61 20 2a 66 69 | 6c 65 30 50 74 72 2c 20 |data *fi|le0Ptr, |
|00001150| 72 65 67 69 73 74 65 72 | 20 73 74 72 75 63 74 20 |register| struct |
|00001160| 66 69 6c 65 5f 64 61 74 | 61 20 2a 66 69 6c 65 31 |file_dat|a *file1|
|00001170| 50 74 72 29 3b 0d 73 74 | 61 74 69 63 20 69 6e 74 |Ptr);.st|atic int|
|00001180| 09 09 09 50 61 74 68 48 | 61 73 45 78 74 65 6e 73 |...PathH|asExtens|
|00001190| 69 6f 6e 20 28 63 6f 6e | 73 74 20 63 68 61 72 20 |ion (con|st char |
|000011a0| 2a 70 61 74 68 43 68 61 | 72 50 74 72 2c 20 63 6f |*pathCha|rPtr, co|
|000011b0| 6e 73 74 20 63 68 61 72 | 20 2a 2a 70 61 74 68 45 |nst char| **pathE|
|000011c0| 78 74 65 6e 73 69 6f 6e | 73 29 3b 0d 0d 0d 20 2f |xtension|s);... /|
|000011d0| 2a 0d 09 2a 20 54 68 69 | 73 20 69 73 20 61 20 6d |*..* Thi|s is a m|
|000011e0| 61 63 68 69 6e 65 20 64 | 65 70 65 6e 64 65 6e 74 |achine d|ependent|
|000011f0| 20 72 6f 75 74 69 6e 65 | 20 74 68 61 74 20 63 6f | routine| that co|
|00001200| 70 69 65 73 20 73 65 6c | 65 63 74 65 64 20 66 69 |pies sel|ected fi|
|00001210| 6c 65 20 66 69 6c 65 41 | 74 74 72 69 62 75 74 65 |le fileA|ttribute|
|00001220| 73 0d 09 2a 20 66 72 6f | 6d 20 74 68 65 20 66 69 |s..* fro|m the fi|
|00001230| 6c 65 20 6e 61 6d 65 64 | 20 73 6f 75 72 63 65 4e |le named| sourceN|
|00001240| 61 6d 65 50 74 72 20 74 | 6f 20 74 68 65 20 66 69 |amePtr t|o the fi|
|00001250| 6c 65 20 6e 61 6d 65 64 | 20 64 65 73 74 4e 61 6d |le named| destNam|
|00001260| 65 50 74 72 20 61 63 63 | 6f 72 64 69 6e 67 0d 09 |ePtr acc|ording..|
|00001270| 2a 20 74 6f 20 66 69 6c | 65 41 74 74 72 69 62 75 |* to fil|eAttribu|
|00001280| 74 65 73 2c 20 77 68 69 | 63 68 20 6d 61 79 20 63 |tes, whi|ch may c|
|00001290| 6f 6e 74 61 69 6e 20 61 | 6e 79 20 6f 66 20 74 68 |ontain a|ny of th|
|000012a0| 65 20 66 6f 6c 6c 6f 77 | 69 6e 67 20 62 69 74 73 |e follow|ing bits|
|000012b0| 3a 0d 09 2a 09 09 4c 4f | 43 4b 5f 4d 41 53 4b 20 |:..*..LO|CK_MASK |
|000012c0| 2d 20 6c 6f 63 6b 73 20 | 74 68 65 20 64 65 73 74 |- locks |the dest|
|000012d0| 69 6e 61 74 69 6f 6e 20 | 66 69 6c 65 0d 09 2a 20 |ination |file..* |
|000012e0| 20 20 44 41 54 45 5f 4d | 41 53 4b 20 2d 20 63 6f | DATE_M|ASK - co|
|000012f0| 70 69 65 73 20 74 68 65 | 20 64 61 74 65 20 66 72 |pies the| date fr|
|00001300| 6f 6d 20 74 68 65 20 73 | 6f 75 72 63 65 20 66 69 |om the s|ource fi|
|00001310| 6c 65 20 74 6f 20 74 68 | 65 20 64 65 73 74 69 6e |le to th|e destin|
|00001320| 61 74 69 6f 6e 20 66 69 | 6c 65 0d 09 2a 09 09 52 |ation fi|le..*..R|
|00001330| 45 53 4f 55 52 43 45 5f | 4d 41 53 4b 20 2d 20 63 |ESOURCE_|MASK - c|
|00001340| 6f 70 69 65 73 20 74 68 | 65 20 72 65 73 6f 75 72 |opies th|e resour|
|00001350| 63 65 20 66 6f 72 6b 20 | 6f 6e 20 4d 61 63 2c 20 |ce fork |on Mac, |
|00001360| 63 6f 70 69 65 73 20 74 | 68 65 20 46 49 4c 45 5f |copies t|he FILE_|
|00001370| 41 54 54 52 49 42 55 54 | 45 5f 48 49 44 44 45 4e |ATTRIBUT|E_HIDDEN|
|00001380| 0d 09 2a 09 09 09 09 09 | 09 09 09 09 09 61 6e 64 |..*.....|.....and|
|00001390| 20 46 49 4c 45 5f 41 54 | 54 52 49 42 55 54 45 5f | FILE_AT|TRIBUTE_|
|000013a0| 53 59 53 54 45 4d 20 61 | 74 74 72 69 62 75 74 65 |SYSTEM a|ttribute|
|000013b0| 20 6f 6e 20 57 69 6e 64 | 6f 77 73 20 61 6e 64 20 | on Wind|ows and |
|000013c0| 74 68 65 20 65 78 65 63 | 75 74 65 0d 09 2a 09 09 |the exec|ute..*..|
|000013d0| 09 09 09 09 09 09 09 09 | 62 69 74 20 6f 6e 20 4e |........|bit on N|
|000013e0| 65 58 54 2e 0d 09 2a 20 | 57 65 20 61 6c 6c 20 6b |eXT...* |We all k|
|000013f0| 6e 6f 77 20 74 68 61 74 | 20 74 68 69 73 20 72 6f |now that| this ro|
|00001400| 75 74 69 6e 65 20 69 73 | 6e 27 74 20 72 65 6c 69 |utine is|n't reli|
|00001410| 61 62 6c 65 20 62 65 63 | 61 75 73 65 20 6f 66 20 |able bec|ause of |
|00001420| 22 72 61 63 65 20 63 6f | 6e 64 69 74 69 6f 6e 73 |"race co|nditions|
|00001430| 2e 22 0d 09 2a 20 54 68 | 65 20 74 69 6d 65 20 74 |."..* Th|e time t|
|00001440| 68 61 74 20 6f 63 63 75 | 72 73 20 62 65 74 77 65 |hat occu|rs betwe|
|00001450| 65 6e 20 77 68 65 6e 20 | 79 6f 75 20 72 65 61 64 |en when |you read|
|00001460| 20 61 20 66 69 6c 65 6e | 61 6d 65 20 61 6e 64 20 | a filen|ame and |
|00001470| 77 68 65 6e 20 79 6f 75 | 20 61 63 63 65 73 73 0d |when you| access.|
|00001480| 09 2a 20 69 74 20 61 6c | 6c 6f 77 73 20 74 68 65 |.* it al|lows the|
|00001490| 20 66 69 6c 65 6e 61 6d | 65 20 74 6f 20 63 68 61 | filenam|e to cha|
|000014a0| 6e 67 65 20 69 6e 20 61 | 20 6d 75 6c 74 69 2d 75 |nge in a| multi-u|
|000014b0| 73 65 72 20 65 6e 76 69 | 72 6f 6e 6d 65 6e 74 2e |ser envi|ronment.|
|000014c0| 20 20 48 6f 77 65 76 65 | 72 2c 20 74 68 65 0d 09 | Howeve|r, the..|
|000014d0| 2a 20 74 79 70 69 63 61 | 6c 20 62 72 61 69 6e 6c |* typica|l brainl|
|000014e0| 65 73 73 20 6f 70 65 72 | 61 74 69 6e 67 20 73 79 |ess oper|ating sy|
|000014f0| 73 74 65 6d 73 20 64 6f | 6e 27 74 20 6c 65 74 20 |stems do|n't let |
|00001500| 79 6f 75 20 72 65 66 65 | 72 20 74 6f 20 66 69 6c |you refe|r to fil|
|00001510| 65 73 20 75 73 69 6e 67 | 20 61 6e 0d 09 2a 20 6f |es using| an..* o|
|00001520| 70 65 6e 20 72 65 66 65 | 72 65 6e 63 65 20 6e 75 |pen refe|rence nu|
|00001530| 6d 62 65 72 20 66 6f 72 | 20 6d 61 6e 79 20 6f 70 |mber for| many op|
|00001540| 65 72 61 74 69 6f 6e 73 | 2c 20 73 75 63 68 20 61 |erations|, such a|
|00001550| 73 20 74 68 6f 73 65 20 | 75 73 65 64 20 69 6e 20 |s those |used in |
|00001560| 74 68 69 73 0d 09 2a 20 | 72 6f 75 74 69 6e 65 2e |this..* |routine.|
|00001570| 0d 09 2a 2f 0d 0d 23 69 | 66 64 65 66 20 44 46 5f |..*/..#i|fdef DF_|
|00001580| 4d 41 43 48 49 4e 45 5f | 4d 41 43 49 4e 54 4f 53 |MACHINE_|MACINTOS|
|00001590| 48 0d 76 6f 69 64 0d 43 | 6f 70 79 46 69 6c 65 41 |H.void.C|opyFileA|
|000015a0| 74 74 72 69 62 75 74 65 | 73 20 28 63 6f 6e 73 74 |ttribute|s (const|
|000015b0| 20 63 68 61 72 20 2a 73 | 6f 75 72 63 65 4e 61 6d | char *s|ourceNam|
|000015c0| 65 50 74 72 2c 20 63 6f | 6e 73 74 20 63 68 61 72 |ePtr, co|nst char|
|000015d0| 20 2a 64 65 73 74 4e 61 | 6d 65 50 74 72 2c 20 63 | *destNa|mePtr, c|
|000015e0| 6f 6e 73 74 20 69 6e 74 | 20 66 69 6c 65 41 74 74 |onst int| fileAtt|
|000015f0| 72 69 62 75 74 65 73 29 | 0d 7b 0d 09 48 50 61 72 |ributes)|.{..HPar|
|00001600| 61 6d 42 6c 6f 63 6b 52 | 65 63 09 64 65 73 74 46 |amBlockR|ec.destF|
|00001610| 49 6e 66 6f 48 50 61 72 | 61 6d 42 6c 6f 63 6b 3b |InfoHPar|amBlock;|
|00001620| 0d 09 48 50 61 72 61 6d | 42 6c 6f 63 6b 52 65 63 |..HParam|BlockRec|
|00001630| 09 64 65 73 74 4c 6f 63 | 6b 48 50 61 72 61 6d 42 |.destLoc|kHParamB|
|00001640| 6c 6f 63 6b 3b 0d 09 53 | 74 72 32 35 35 09 09 09 |lock;..S|tr255...|
|00001650| 09 09 64 65 73 74 4e 61 | 6d 65 50 53 74 72 69 6e |..destNa|mePStrin|
|00001660| 67 3b 0d 09 50 61 72 61 | 6d 42 6c 6f 63 6b 52 65 |g;..Para|mBlockRe|
|00001670| 63 09 09 64 65 73 74 52 | 65 73 6f 75 72 63 65 50 |c..destR|esourceP|
|00001680| 61 72 61 6d 42 6c 6b 3b | 0d 09 69 6e 74 20 09 09 |aramBlk;|..int ..|
|00001690| 09 09 09 09 69 6f 52 65 | 73 75 6c 74 3b 0d 09 69 |....ioRe|sult;..i|
|000016a0| 6e 74 09 09 09 09 09 09 | 09 70 61 74 68 4c 65 6e |nt......|.pathLen|
|000016b0| 67 74 68 3b 0d 09 69 6e | 74 09 09 09 09 09 09 09 |gth;..in|t.......|
|000016c0| 73 6f 75 72 63 65 46 49 | 6e 66 6f 45 78 69 73 74 |sourceFI|nfoExist|
|000016d0| 73 3b 0d 09 48 50 61 72 | 61 6d 42 6c 6f 63 6b 52 |s;..HPar|amBlockR|
|000016e0| 65 63 09 73 6f 75 72 63 | 65 46 49 6e 66 6f 48 50 |ec.sourc|eFInfoHP|
|000016f0| 61 72 61 6d 42 6c 6f 63 | 6b 3b 0d 09 53 74 72 32 |aramBloc|k;..Str2|
|00001700| 35 35 09 09 09 09 09 73 | 6f 75 72 63 65 4e 61 6d |55.....s|ourceNam|
|00001710| 65 50 53 74 72 69 6e 67 | 3b 0d 09 50 61 72 61 6d |ePString|;..Param|
|00001720| 42 6c 6f 63 6b 52 65 63 | 09 09 73 6f 75 72 63 65 |BlockRec|..source|
|00001730| 52 65 73 6f 75 72 63 65 | 50 61 72 61 6d 42 6c 6b |Resource|ParamBlk|
|00001740| 3b 0d 0d 09 69 66 20 28 | 66 69 6c 65 41 74 74 72 |;...if (|fileAttr|
|00001750| 69 62 75 74 65 73 20 21 | 3d 20 30 29 20 7b 0d 09 |ibutes !|= 0) {..|
|00001760| 09 70 61 74 68 4c 65 6e | 67 74 68 20 3d 20 73 74 |.pathLen|gth = st|
|00001770| 72 6c 65 6e 20 28 64 65 | 73 74 4e 61 6d 65 50 74 |rlen (de|stNamePt|
|00001780| 72 29 3b 0d 09 09 69 66 | 20 28 70 61 74 68 4c 65 |r);...if| (pathLe|
|00001790| 6e 67 74 68 20 3e 20 46 | 49 4c 45 4e 41 4d 45 5f |ngth > F|ILENAME_|
|000017a0| 4d 41 58 29 20 7b 0d 09 | 09 09 66 70 72 69 6e 74 |MAX) {..|..fprint|
|000017b0| 66 20 28 73 74 64 65 72 | 72 2c 20 22 25 73 5c 6e |f (stder|r, "%s\n|
|000017c0| 22 2c 20 64 65 73 74 4e | 61 6d 65 50 74 72 29 3b |", destN|amePtr);|
|000017d0| 0d 09 09 09 45 72 72 6f | 72 20 28 50 41 54 48 5f |....Erro|r (PATH_|
|000017e0| 54 4f 4f 5f 4c 4f 4e 47 | 29 3b 0d 09 09 7d 0d 09 |TOO_LONG|);...}..|
|000017f0| 09 64 65 73 74 4e 61 6d | 65 50 53 74 72 69 6e 67 |.destNam|ePString|
|00001800| 20 5b 30 5d 20 3d 20 28 | 75 6e 73 69 67 6e 65 64 | [0] = (|unsigned|
|00001810| 20 63 68 61 72 29 20 70 | 61 74 68 4c 65 6e 67 74 | char) p|athLengt|
|00001820| 68 3b 0d 09 09 6d 65 6d | 63 70 79 20 28 64 65 73 |h;...mem|cpy (des|
|00001830| 74 4e 61 6d 65 50 53 74 | 72 69 6e 67 20 2b 20 31 |tNamePSt|ring + 1|
|00001840| 2c 20 64 65 73 74 4e 61 | 6d 65 50 74 72 2c 20 70 |, destNa|mePtr, p|
|00001850| 61 74 68 4c 65 6e 67 74 | 68 29 3b 0d 0d 09 09 70 |athLengt|h);....p|
|00001860| 61 74 68 4c 65 6e 67 74 | 68 20 3d 20 73 74 72 6c |athLengt|h = strl|
|00001870| 65 6e 20 28 73 6f 75 72 | 63 65 4e 61 6d 65 50 74 |en (sour|ceNamePt|
|00001880| 72 29 3b 0d 09 09 69 66 | 20 28 70 61 74 68 4c 65 |r);...if| (pathLe|
|00001890| 6e 67 74 68 20 3e 20 46 | 49 4c 45 4e 41 4d 45 5f |ngth > F|ILENAME_|
|000018a0| 4d 41 58 29 20 7b 0d 09 | 09 09 66 70 72 69 6e 74 |MAX) {..|..fprint|
|000018b0| 66 20 28 73 74 64 65 72 | 72 2c 20 22 25 73 5c 6e |f (stder|r, "%s\n|
|000018c0| 22 2c 20 73 6f 75 72 63 | 65 4e 61 6d 65 50 74 72 |", sourc|eNamePtr|
|000018d0| 29 3b 0d 09 09 09 45 72 | 72 6f 72 20 28 50 41 54 |);....Er|ror (PAT|
|000018e0| 48 5f 54 4f 4f 5f 4c 4f | 4e 47 29 3b 0d 09 09 7d |H_TOO_LO|NG);...}|
|000018f0| 0d 09 09 73 6f 75 72 63 | 65 4e 61 6d 65 50 53 74 |...sourc|eNamePSt|
|00001900| 72 69 6e 67 20 5b 30 5d | 20 3d 20 28 75 6e 73 69 |ring [0]| = (unsi|
|00001910| 67 6e 65 64 20 63 68 61 | 72 29 20 70 61 74 68 4c |gned cha|r) pathL|
|00001920| 65 6e 67 74 68 3b 0d 09 | 09 6d 65 6d 63 70 79 20 |ength;..|.memcpy |
|00001930| 28 73 6f 75 72 63 65 4e | 61 6d 65 50 53 74 72 69 |(sourceN|amePStri|
|00001940| 6e 67 20 2b 20 31 2c 20 | 73 6f 75 72 63 65 4e 61 |ng + 1, |sourceNa|
|00001950| 6d 65 50 74 72 2c 20 70 | 61 74 68 4c 65 6e 67 74 |mePtr, p|athLengt|
|00001960| 68 29 3b 0d 0d 09 09 73 | 6f 75 72 63 65 46 49 6e |h);....s|ourceFIn|
|00001970| 66 6f 45 78 69 73 74 73 | 20 3d 20 46 41 4c 53 45 |foExists| = FALSE|
|00001980| 3b 0d 09 09 69 66 20 28 | 28 66 69 6c 65 41 74 74 |;...if (|(fileAtt|
|00001990| 72 69 62 75 74 65 73 20 | 26 20 28 44 41 54 45 5f |ributes |& (DATE_|
|000019a0| 4d 41 53 4b 20 7c 20 52 | 45 53 4f 55 52 43 45 5f |MASK | R|ESOURCE_|
|000019b0| 4d 41 53 4b 29 29 20 21 | 3d 20 30 29 20 7b 0d 09 |MASK)) !|= 0) {..|
|000019c0| 09 09 62 7a 65 72 6f 20 | 28 26 64 65 73 74 46 49 |..bzero |(&destFI|
|000019d0| 6e 66 6f 48 50 61 72 61 | 6d 42 6c 6f 63 6b 2c 20 |nfoHPara|mBlock, |
|000019e0| 73 69 7a 65 6f 66 20 28 | 48 50 61 72 61 6d 42 6c |sizeof (|HParamBl|
|000019f0| 6f 63 6b 52 65 63 29 29 | 3b 0d 09 09 09 64 65 73 |ockRec))|;....des|
|00001a00| 74 46 49 6e 66 6f 48 50 | 61 72 61 6d 42 6c 6f 63 |tFInfoHP|aramBloc|
|00001a10| 6b 2e 66 69 6c 65 50 61 | 72 61 6d 2e 69 6f 4e 61 |k.filePa|ram.ioNa|
|00001a20| 6d 65 50 74 72 20 3d 20 | 64 65 73 74 4e 61 6d 65 |mePtr = |destName|
|00001a30| 50 53 74 72 69 6e 67 3b | 0d 09 09 09 69 6f 52 65 |PString;|....ioRe|
|00001a40| 73 75 6c 74 20 3d 20 50 | 42 48 47 65 74 46 49 6e |sult = P|BHGetFIn|
|00001a50| 66 6f 53 79 6e 63 20 28 | 26 64 65 73 74 46 49 6e |foSync (|&destFIn|
|00001a60| 66 6f 48 50 61 72 61 6d | 42 6c 6f 63 6b 29 3b 0d |foHParam|Block);.|
|00001a70| 09 09 09 69 66 20 28 69 | 6f 52 65 73 75 6c 74 20 |...if (i|oResult |
|00001a80| 21 3d 20 6e 6f 45 72 72 | 29 0d 09 09 09 09 45 72 |!= noErr|).....Er|
|00001a90| 72 6f 72 57 69 74 68 53 | 74 72 69 6e 67 41 72 67 |rorWithS|tringArg|
|00001aa0| 75 6d 65 6e 74 20 28 55 | 4e 45 58 50 45 43 54 45 |ument (U|NEXPECTE|
|00001ab0| 44 5f 49 4f 5f 45 52 52 | 4f 52 2c 20 64 65 73 74 |D_IO_ERR|OR, dest|
|00001ac0| 4e 61 6d 65 50 74 72 29 | 3b 0d 0d 09 09 09 62 7a |NamePtr)|;.....bz|
|00001ad0| 65 72 6f 20 28 26 73 6f | 75 72 63 65 46 49 6e 66 |ero (&so|urceFInf|
|00001ae0| 6f 48 50 61 72 61 6d 42 | 6c 6f 63 6b 2c 20 73 69 |oHParamB|lock, si|
|00001af0| 7a 65 6f 66 20 28 48 50 | 61 72 61 6d 42 6c 6f 63 |zeof (HP|aramBloc|
|00001b00| 6b 52 65 63 29 29 3b 0d | 09 09 09 73 6f 75 72 63 |kRec));.|...sourc|
|00001b10| 65 46 49 6e 66 6f 48 50 | 61 72 61 6d 42 6c 6f 63 |eFInfoHP|aramBloc|
|00001b20| 6b 2e 66 69 6c 65 50 61 | 72 61 6d 2e 69 6f 4e 61 |k.filePa|ram.ioNa|
|00001b30| 6d 65 50 74 72 20 3d 20 | 73 6f 75 72 63 65 4e 61 |mePtr = |sourceNa|
|00001b40| 6d 65 50 53 74 72 69 6e | 67 3b 0d 09 09 09 69 6f |mePStrin|g;....io|
|00001b50| 52 65 73 75 6c 74 20 3d | 20 50 42 48 47 65 74 46 |Result =| PBHGetF|
|00001b60| 49 6e 66 6f 53 79 6e 63 | 20 28 26 73 6f 75 72 63 |InfoSync| (&sourc|
|00001b70| 65 46 49 6e 66 6f 48 50 | 61 72 61 6d 42 6c 6f 63 |eFInfoHP|aramBloc|
|00001b80| 6b 29 3b 0d 09 09 09 73 | 6f 75 72 63 65 46 49 6e |k);....s|ourceFIn|
|00001b90| 66 6f 45 78 69 73 74 73 | 20 3d 20 69 6f 52 65 73 |foExists| = ioRes|
|00001ba0| 75 6c 74 20 3d 3d 20 6e | 6f 45 72 72 3b 0d 09 09 |ult == n|oErr;...|
|00001bb0| 7d 0d 0d 09 09 69 66 20 | 28 28 66 69 6c 65 41 74 |}....if |((fileAt|
|00001bc0| 74 72 69 62 75 74 65 73 | 20 26 20 52 45 53 4f 55 |tributes| & RESOU|
|00001bd0| 52 43 45 5f 4d 41 53 4b | 29 20 21 3d 20 30 29 20 |RCE_MASK|) != 0) |
|00001be0| 7b 0d 09 09 09 62 7a 65 | 72 6f 20 28 26 73 6f 75 |{....bze|ro (&sou|
|00001bf0| 72 63 65 52 65 73 6f 75 | 72 63 65 50 61 72 61 6d |rceResou|rceParam|
|00001c00| 42 6c 6b 2c 20 73 69 7a | 65 6f 66 20 28 50 61 72 |Blk, siz|eof (Par|
|00001c10| 61 6d 42 6c 6f 63 6b 52 | 65 63 29 29 3b 0d 09 09 |amBlockR|ec));...|
|00001c20| 09 73 6f 75 72 63 65 52 | 65 73 6f 75 72 63 65 50 |.sourceR|esourceP|
|00001c30| 61 72 61 6d 42 6c 6b 2e | 66 69 6c 65 50 61 72 61 |aramBlk.|filePara|
|00001c40| 6d 2e 69 6f 4e 61 6d 65 | 50 74 72 20 3d 20 73 6f |m.ioName|Ptr = so|
|00001c50| 75 72 63 65 4e 61 6d 65 | 50 53 74 72 69 6e 67 3b |urceName|PString;|
|00001c60| 0d 09 09 09 73 6f 75 72 | 63 65 52 65 73 6f 75 72 |....sour|ceResour|
|00001c70| 63 65 50 61 72 61 6d 42 | 6c 6b 2e 69 6f 50 61 72 |ceParamB|lk.ioPar|
|00001c80| 61 6d 2e 69 6f 50 65 72 | 6d 73 73 6e 20 3d 20 66 |am.ioPer|mssn = f|
|00001c90| 73 52 64 50 65 72 6d 3b | 0d 09 09 09 69 6f 52 65 |sRdPerm;|....ioRe|
|00001ca0| 73 75 6c 74 20 3d 20 50 | 42 4f 70 65 6e 52 46 53 |sult = P|BOpenRFS|
|00001cb0| 79 6e 63 20 28 26 73 6f | 75 72 63 65 52 65 73 6f |ync (&so|urceReso|
|00001cc0| 75 72 63 65 50 61 72 61 | 6d 42 6c 6b 29 3b 0d 09 |urcePara|mBlk);..|
|00001cd0| 09 09 69 66 20 28 69 6f | 52 65 73 75 6c 74 20 3d |..if (io|Result =|
|00001ce0| 3d 20 6e 6f 45 72 72 29 | 20 7b 20 2f 2a 20 44 6f |= noErr)| { /* Do|
|00001cf0| 6e 27 74 20 63 6f 70 79 | 20 69 66 20 73 6f 75 72 |n't copy| if sour|
|00001d00| 63 65 20 64 6f 65 73 6e | 27 74 20 65 78 69 73 74 |ce doesn|'t exist|
|00001d10| 20 2a 2f 0d 09 09 09 09 | 62 7a 65 72 6f 20 28 26 | */.....|bzero (&|
|00001d20| 64 65 73 74 52 65 73 6f | 75 72 63 65 50 61 72 61 |destReso|urcePara|
|00001d30| 6d 42 6c 6b 2c 20 73 69 | 7a 65 6f 66 20 28 50 61 |mBlk, si|zeof (Pa|
|00001d40| 72 61 6d 42 6c 6f 63 6b | 52 65 63 29 29 3b 0d 09 |ramBlock|Rec));..|
|00001d50| 09 09 09 64 65 73 74 52 | 65 73 6f 75 72 63 65 50 |...destR|esourceP|
|00001d60| 61 72 61 6d 42 6c 6b 2e | 66 69 6c 65 50 61 72 61 |aramBlk.|filePara|
|00001d70| 6d 2e 69 6f 4e 61 6d 65 | 50 74 72 20 3d 20 64 65 |m.ioName|Ptr = de|
|00001d80| 73 74 4e 61 6d 65 50 53 | 74 72 69 6e 67 3b 0d 09 |stNamePS|tring;..|
|00001d90| 09 09 09 64 65 73 74 52 | 65 73 6f 75 72 63 65 50 |...destR|esourceP|
|00001da0| 61 72 61 6d 42 6c 6b 2e | 69 6f 50 61 72 61 6d 2e |aramBlk.|ioParam.|
|00001db0| 69 6f 50 65 72 6d 73 73 | 6e 20 3d 20 66 73 57 72 |ioPermss|n = fsWr|
|00001dc0| 50 65 72 6d 3b 0d 09 09 | 09 09 69 6f 52 65 73 75 |Perm;...|..ioResu|
|00001dd0| 6c 74 20 3d 20 50 42 4f | 70 65 6e 52 46 53 79 6e |lt = PBO|penRFSyn|
|00001de0| 63 20 28 26 64 65 73 74 | 52 65 73 6f 75 72 63 65 |c (&dest|Resource|
|00001df0| 50 61 72 61 6d 42 6c 6b | 29 3b 0d 09 09 09 09 69 |ParamBlk|);.....i|
|00001e00| 66 20 28 69 6f 52 65 73 | 75 6c 74 20 21 3d 20 6e |f (ioRes|ult != n|
|00001e10| 6f 45 72 72 29 0d 09 09 | 09 09 09 45 72 72 6f 72 |oErr)...|...Error|
|00001e20| 57 69 74 68 53 74 72 69 | 6e 67 41 72 67 75 6d 65 |WithStri|ngArgume|
|00001e30| 6e 74 20 28 55 4e 45 58 | 50 45 43 54 45 44 5f 49 |nt (UNEX|PECTED_I|
|00001e40| 4f 5f 45 52 52 4f 52 2c | 20 64 65 73 74 4e 61 6d |O_ERROR,| destNam|
|00001e50| 65 50 74 72 29 3b 0d 09 | 09 09 09 69 6f 52 65 73 |ePtr);..|...ioRes|
|00001e60| 75 6c 74 20 3d 20 50 42 | 47 65 74 45 4f 46 53 79 |ult = PB|GetEOFSy|
|00001e70| 6e 63 20 28 26 73 6f 75 | 72 63 65 52 65 73 6f 75 |nc (&sou|rceResou|
|00001e80| 72 63 65 50 61 72 61 6d | 42 6c 6b 29 3b 0d 09 09 |rceParam|Blk);...|
|00001e90| 09 09 69 66 20 28 69 6f | 52 65 73 75 6c 74 20 21 |..if (io|Result !|
|00001ea0| 3d 20 6e 6f 45 72 72 29 | 0d 09 09 09 09 09 45 72 |= noErr)|......Er|
|00001eb0| 72 6f 72 57 69 74 68 53 | 74 72 69 6e 67 41 72 67 |rorWithS|tringArg|
|00001ec0| 75 6d 65 6e 74 20 28 55 | 4e 45 58 50 45 43 54 45 |ument (U|NEXPECTE|
|00001ed0| 44 5f 49 4f 5f 45 52 52 | 4f 52 2c 20 73 6f 75 72 |D_IO_ERR|OR, sour|
|00001ee0| 63 65 4e 61 6d 65 50 74 | 72 29 3b 0d 09 09 09 09 |ceNamePt|r);.....|
|00001ef0| 73 6f 75 72 63 65 52 65 | 73 6f 75 72 63 65 50 61 |sourceRe|sourcePa|
|00001f00| 72 61 6d 42 6c 6b 2e 69 | 6f 50 61 72 61 6d 2e 69 |ramBlk.i|oParam.i|
|00001f10| 6f 42 75 66 66 65 72 20 | 3d 20 78 6d 61 6c 6c 6f |oBuffer |= xmallo|
|00001f20| 63 20 28 28 73 69 7a 65 | 5f 74 29 20 73 6f 75 72 |c ((size|_t) sour|
|00001f30| 63 65 52 65 73 6f 75 72 | 63 65 50 61 72 61 6d 42 |ceResour|ceParamB|
|00001f40| 6c 6b 2e 69 6f 50 61 72 | 61 6d 2e 69 6f 4d 69 73 |lk.ioPar|am.ioMis|
|00001f50| 63 29 3b 0d 09 09 09 09 | 73 6f 75 72 63 65 52 65 |c);.....|sourceRe|
|00001f60| 73 6f 75 72 63 65 50 61 | 72 61 6d 42 6c 6b 2e 69 |sourcePa|ramBlk.i|
|00001f70| 6f 50 61 72 61 6d 2e 69 | 6f 52 65 71 43 6f 75 6e |oParam.i|oReqCoun|
|00001f80| 74 20 3d 20 28 6c 6f 6e | 67 29 20 73 6f 75 72 63 |t = (lon|g) sourc|
|00001f90| 65 52 65 73 6f 75 72 63 | 65 50 61 72 61 6d 42 6c |eResourc|eParamBl|
|00001fa0| 6b 2e 69 6f 50 61 72 61 | 6d 2e 69 6f 4d 69 73 63 |k.ioPara|m.ioMisc|
|00001fb0| 3b 0d 09 09 09 09 73 6f | 75 72 63 65 52 65 73 6f |;.....so|urceReso|
|00001fc0| 75 72 63 65 50 61 72 61 | 6d 42 6c 6b 2e 69 6f 50 |urcePara|mBlk.ioP|
|00001fd0| 61 72 61 6d 2e 69 6f 50 | 6f 73 4d 6f 64 65 20 3d |aram.ioP|osMode =|
|00001fe0| 20 66 73 46 72 6f 6d 53 | 74 61 72 74 3b 0d 09 09 | fsFromS|tart;...|
|00001ff0| 09 09 69 6f 52 65 73 75 | 6c 74 20 3d 20 50 42 52 |..ioResu|lt = PBR|
|00002000| 65 61 64 53 79 6e 63 20 | 28 26 73 6f 75 72 63 65 |eadSync |(&source|
|00002010| 52 65 73 6f 75 72 63 65 | 50 61 72 61 6d 42 6c 6b |Resource|ParamBlk|
|00002020| 29 3b 0d 09 09 09 09 69 | 66 20 28 69 6f 52 65 73 |);.....i|f (ioRes|
|00002030| 75 6c 74 20 21 3d 20 6e | 6f 45 72 72 29 0d 09 09 |ult != n|oErr)...|
|00002040| 09 09 09 45 72 72 6f 72 | 57 69 74 68 53 74 72 69 |...Error|WithStri|
|00002050| 6e 67 41 72 67 75 6d 65 | 6e 74 20 28 55 4e 45 58 |ngArgume|nt (UNEX|
|00002060| 50 45 43 54 45 44 5f 49 | 4f 5f 45 52 52 4f 52 2c |PECTED_I|O_ERROR,|
|00002070| 20 73 6f 75 72 63 65 4e | 61 6d 65 50 74 72 29 3b | sourceN|amePtr);|
|00002080| 0d 09 09 09 09 64 65 73 | 74 52 65 73 6f 75 72 63 |.....des|tResourc|
|00002090| 65 50 61 72 61 6d 42 6c | 6b 2e 69 6f 50 61 72 61 |eParamBl|k.ioPara|
|000020a0| 6d 2e 69 6f 42 75 66 66 | 65 72 20 3d 20 73 6f 75 |m.ioBuff|er = sou|
|000020b0| 72 63 65 52 65 73 6f 75 | 72 63 65 50 61 72 61 6d |rceResou|rceParam|
|000020c0| 42 6c 6b 2e 69 6f 50 61 | 72 61 6d 2e 69 6f 42 75 |Blk.ioPa|ram.ioBu|
|000020d0| 66 66 65 72 3b 0d 09 09 | 09 09 64 65 73 74 52 65 |ffer;...|..destRe|
|000020e0| 73 6f 75 72 63 65 50 61 | 72 61 6d 42 6c 6b 2e 69 |sourcePa|ramBlk.i|
|000020f0| 6f 50 61 72 61 6d 2e 69 | 6f 52 65 71 43 6f 75 6e |oParam.i|oReqCoun|
|00002100| 74 20 3d 20 28 6c 6f 6e | 67 29 20 73 6f 75 72 63 |t = (lon|g) sourc|
|00002110| 65 52 65 73 6f 75 72 63 | 65 50 61 72 61 6d 42 6c |eResourc|eParamBl|
|00002120| 6b 2e 69 6f 50 61 72 61 | 6d 2e 69 6f 4d 69 73 63 |k.ioPara|m.ioMisc|
|00002130| 3b 0d 09 09 09 09 64 65 | 73 74 52 65 73 6f 75 72 |;.....de|stResour|
|00002140| 63 65 50 61 72 61 6d 42 | 6c 6b 2e 69 6f 50 61 72 |ceParamB|lk.ioPar|
|00002150| 61 6d 2e 69 6f 50 6f 73 | 4d 6f 64 65 20 3d 20 66 |am.ioPos|Mode = f|
|00002160| 73 46 72 6f 6d 53 74 61 | 72 74 3b 0d 09 09 09 09 |sFromSta|rt;.....|
|00002170| 69 6f 52 65 73 75 6c 74 | 20 3d 20 50 42 57 72 69 |ioResult| = PBWri|
|00002180| 74 65 53 79 6e 63 20 28 | 26 64 65 73 74 52 65 73 |teSync (|&destRes|
|00002190| 6f 75 72 63 65 50 61 72 | 61 6d 42 6c 6b 29 3b 0d |ourcePar|amBlk);.|
|000021a0| 09 09 09 09 69 66 20 28 | 69 6f 52 65 73 75 6c 74 |....if (|ioResult|
|000021b0| 20 21 3d 20 6e 6f 45 72 | 72 29 0d 09 09 09 09 09 | != noEr|r)......|
|000021c0| 45 72 72 6f 72 57 69 74 | 68 53 74 72 69 6e 67 41 |ErrorWit|hStringA|
|000021d0| 72 67 75 6d 65 6e 74 20 | 28 55 4e 45 58 50 45 43 |rgument |(UNEXPEC|
|000021e0| 54 45 44 5f 49 4f 5f 45 | 52 52 4f 52 2c 20 64 65 |TED_IO_E|RROR, de|
|000021f0| 73 74 4e 61 6d 65 50 74 | 72 29 3b 0d 09 09 09 09 |stNamePt|r);.....|
|00002200| 66 72 65 65 20 28 73 6f | 75 72 63 65 52 65 73 6f |free (so|urceReso|
|00002210| 75 72 63 65 50 61 72 61 | 6d 42 6c 6b 2e 69 6f 50 |urcePara|mBlk.ioP|
|00002220| 61 72 61 6d 2e 69 6f 42 | 75 66 66 65 72 29 3b 0d |aram.ioB|uffer);.|
|00002230| 09 09 09 09 69 6f 52 65 | 73 75 6c 74 20 3d 20 50 |....ioRe|sult = P|
|00002240| 42 43 6c 6f 73 65 53 79 | 6e 63 20 28 26 73 6f 75 |BCloseSy|nc (&sou|
|00002250| 72 63 65 52 65 73 6f 75 | 72 63 65 50 61 72 61 6d |rceResou|rceParam|
|00002260| 42 6c 6b 29 3b 0d 09 09 | 09 09 69 66 20 28 69 6f |Blk);...|..if (io|
|00002270| 52 65 73 75 6c 74 20 21 | 3d 20 6e 6f 45 72 72 29 |Result !|= noErr)|
|00002280| 0d 09 09 09 09 09 45 72 | 72 6f 72 57 69 74 68 53 |......Er|rorWithS|
|00002290| 74 72 69 6e 67 41 72 67 | 75 6d 65 6e 74 20 28 55 |tringArg|ument (U|
|000022a0| 4e 45 58 50 45 43 54 45 | 44 5f 49 4f 5f 45 52 52 |NEXPECTE|D_IO_ERR|
|000022b0| 4f 52 2c 20 73 6f 75 72 | 63 65 4e 61 6d 65 50 74 |OR, sour|ceNamePt|
|000022c0| 72 29 3b 0d 09 09 09 09 | 69 6f 52 65 73 75 6c 74 |r);.....|ioResult|
|000022d0| 20 3d 20 50 42 43 6c 6f | 73 65 53 79 6e 63 20 28 | = PBClo|seSync (|
|000022e0| 26 64 65 73 74 52 65 73 | 6f 75 72 63 65 50 61 72 |&destRes|ourcePar|
|000022f0| 61 6d 42 6c 6b 29 3b 0d | 09 09 09 09 69 66 20 28 |amBlk);.|....if (|
|00002300| 69 6f 52 65 73 75 6c 74 | 20 21 3d 20 6e 6f 45 72 |ioResult| != noEr|
|00002310| 72 29 0d 09 09 09 09 09 | 45 72 72 6f 72 57 69 74 |r)......|ErrorWit|
|00002320| 68 53 74 72 69 6e 67 41 | 72 67 75 6d 65 6e 74 20 |hStringA|rgument |
|00002330| 28 55 4e 45 58 50 45 43 | 54 45 44 5f 49 4f 5f 45 |(UNEXPEC|TED_IO_E|
|00002340| 52 52 4f 52 2c 20 64 65 | 73 74 4e 61 6d 65 50 74 |RROR, de|stNamePt|
|00002350| 72 29 3b 0d 09 09 09 7d | 0d 09 09 09 69 66 20 28 |r);....}|....if (|
|00002360| 73 6f 75 72 63 65 46 49 | 6e 66 6f 45 78 69 73 74 |sourceFI|nfoExist|
|00002370| 73 29 20 7b 0d 09 09 09 | 09 64 65 73 74 46 49 6e |s) {....|.destFIn|
|00002380| 66 6f 48 50 61 72 61 6d | 42 6c 6f 63 6b 2e 66 69 |foHParam|Block.fi|
|00002390| 6c 65 50 61 72 61 6d 2e | 69 6f 46 6c 46 6e 64 72 |leParam.|ioFlFndr|
|000023a0| 49 6e 66 6f 2e 66 64 54 | 79 70 65 20 3d 0d 09 09 |Info.fdT|ype =...|
|000023b0| 09 09 09 73 6f 75 72 63 | 65 46 49 6e 66 6f 48 50 |...sourc|eFInfoHP|
|000023c0| 61 72 61 6d 42 6c 6f 63 | 6b 2e 66 69 6c 65 50 61 |aramBloc|k.filePa|
|000023d0| 72 61 6d 2e 69 6f 46 6c | 46 6e 64 72 49 6e 66 6f |ram.ioFl|FndrInfo|
|000023e0| 2e 66 64 54 79 70 65 3b | 0d 09 09 09 09 64 65 73 |.fdType;|.....des|
|000023f0| 74 46 49 6e 66 6f 48 50 | 61 72 61 6d 42 6c 6f 63 |tFInfoHP|aramBloc|
|00002400| 6b 2e 66 69 6c 65 50 61 | 72 61 6d 2e 69 6f 46 6c |k.filePa|ram.ioFl|
|00002410| 46 6e 64 72 49 6e 66 6f | 2e 66 64 43 72 65 61 74 |FndrInfo|.fdCreat|
|00002420| 6f 72 20 3d 0d 09 09 09 | 09 09 73 6f 75 72 63 65 |or =....|..source|
|00002430| 46 49 6e 66 6f 48 50 61 | 72 61 6d 42 6c 6f 63 6b |FInfoHPa|ramBlock|
|00002440| 2e 66 69 6c 65 50 61 72 | 61 6d 2e 69 6f 46 6c 46 |.filePar|am.ioFlF|
|00002450| 6e 64 72 49 6e 66 6f 2e | 66 64 43 72 65 61 74 6f |ndrInfo.|fdCreato|
|00002460| 72 3b 0d 09 09 09 09 64 | 65 73 74 46 49 6e 66 6f |r;.....d|estFInfo|
|00002470| 48 50 61 72 61 6d 42 6c | 6f 63 6b 2e 66 69 6c 65 |HParamBl|ock.file|
|00002480| 50 61 72 61 6d 2e 69 6f | 46 6c 46 6e 64 72 49 6e |Param.io|FlFndrIn|
|00002490| 66 6f 2e 66 64 4c 6f 63 | 61 74 69 6f 6e 20 3d 0d |fo.fdLoc|ation =.|
|000024a0| 09 09 09 09 09 73 6f 75 | 72 63 65 46 49 6e 66 6f |.....sou|rceFInfo|
|000024b0| 48 50 61 72 61 6d 42 6c | 6f 63 6b 2e 66 69 6c 65 |HParamBl|ock.file|
|000024c0| 50 61 72 61 6d 2e 69 6f | 46 6c 46 6e 64 72 49 6e |Param.io|FlFndrIn|
|000024d0| 66 6f 2e 66 64 4c 6f 63 | 61 74 69 6f 6e 3b 0d 09 |fo.fdLoc|ation;..|
|000024e0| 09 09 7d 0d 09 09 7d 0d | 09 09 69 66 20 28 28 66 |..}...}.|..if ((f|
|000024f0| 69 6c 65 41 74 74 72 69 | 62 75 74 65 73 20 26 20 |ileAttri|butes & |
|00002500| 44 41 54 45 5f 4d 41 53 | 4b 29 20 21 3d 20 30 20 |DATE_MAS|K) != 0 |
|00002510| 26 26 20 73 6f 75 72 63 | 65 46 49 6e 66 6f 45 78 |&& sourc|eFInfoEx|
|00002520| 69 73 74 73 29 20 7b 0d | 09 09 09 64 65 73 74 46 |ists) {.|...destF|
|00002530| 49 6e 66 6f 48 50 61 72 | 61 6d 42 6c 6f 63 6b 2e |InfoHPar|amBlock.|
|00002540| 66 69 6c 65 50 61 72 61 | 6d 2e 69 6f 46 6c 43 72 |filePara|m.ioFlCr|
|00002550| 44 61 74 20 3d 20 73 6f | 75 72 63 65 46 49 6e 66 |Dat = so|urceFInf|
|00002560| 6f 48 50 61 72 61 6d 42 | 6c 6f 63 6b 2e 66 69 6c |oHParamB|lock.fil|
|00002570| 65 50 61 72 61 6d 2e 69 | 6f 46 6c 43 72 44 61 74 |eParam.i|oFlCrDat|
|00002580| 3b 0d 09 09 09 64 65 73 | 74 46 49 6e 66 6f 48 50 |;....des|tFInfoHP|
|00002590| 61 72 61 6d 42 6c 6f 63 | 6b 2e 66 69 6c 65 50 61 |aramBloc|k.filePa|
|000025a0| 72 61 6d 2e 69 6f 46 6c | 4d 64 44 61 74 20 3d 20 |ram.ioFl|MdDat = |
|000025b0| 73 6f 75 72 63 65 46 49 | 6e 66 6f 48 50 61 72 61 |sourceFI|nfoHPara|
|000025c0| 6d 42 6c 6f 63 6b 2e 66 | 69 6c 65 50 61 72 61 6d |mBlock.f|ileParam|
|000025d0| 2e 69 6f 46 6c 4d 64 44 | 61 74 3b 0d 09 09 7d 0d |.ioFlMdD|at;...}.|
|000025e0| 09 09 69 66 20 28 28 66 | 69 6c 65 41 74 74 72 69 |..if ((f|ileAttri|
|000025f0| 62 75 74 65 73 20 26 20 | 4c 4f 43 4b 5f 4d 41 53 |butes & |LOCK_MAS|
|00002600| 4b 29 20 21 3d 20 30 29 | 20 7b 0d 09 09 09 62 7a |K) != 0)| {....bz|
|00002610| 65 72 6f 20 28 26 64 65 | 73 74 4c 6f 63 6b 48 50 |ero (&de|stLockHP|
|00002620| 61 72 61 6d 42 6c 6f 63 | 6b 2c 20 73 69 7a 65 6f |aramBloc|k, sizeo|
|00002630| 66 20 28 48 50 61 72 61 | 6d 42 6c 6f 63 6b 52 65 |f (HPara|mBlockRe|
|00002640| 63 29 29 3b 0d 09 09 09 | 64 65 73 74 4c 6f 63 6b |c));....|destLock|
|00002650| 48 50 61 72 61 6d 42 6c | 6f 63 6b 2e 66 69 6c 65 |HParamBl|ock.file|
|00002660| 50 61 72 61 6d 2e 69 6f | 4e 61 6d 65 50 74 72 20 |Param.io|NamePtr |
|00002670| 3d 20 64 65 73 74 4e 61 | 6d 65 50 53 74 72 69 6e |= destNa|mePStrin|
|00002680| 67 3b 0d 09 09 09 69 6f | 52 65 73 75 6c 74 20 3d |g;....io|Result =|
|00002690| 20 50 42 48 53 65 74 46 | 4c 6f 63 6b 53 79 6e 63 | PBHSetF|LockSync|
|000026a0| 20 28 26 64 65 73 74 4c | 6f 63 6b 48 50 61 72 61 | (&destL|ockHPara|
|000026b0| 6d 42 6c 6f 63 6b 29 3b | 0d 09 09 09 69 66 20 28 |mBlock);|....if (|
|000026c0| 69 6f 52 65 73 75 6c 74 | 20 21 3d 20 6e 6f 45 72 |ioResult| != noEr|
|000026d0| 72 29 0d 09 09 09 09 45 | 72 72 6f 72 57 69 74 68 |r).....E|rrorWith|
|000026e0| 53 74 72 69 6e 67 41 72 | 67 75 6d 65 6e 74 20 28 |StringAr|gument (|
|000026f0| 55 4e 45 58 50 45 43 54 | 45 44 5f 49 4f 5f 45 52 |UNEXPECT|ED_IO_ER|
|00002700| 52 4f 52 2c 20 64 65 73 | 74 4e 61 6d 65 50 74 72 |ROR, des|tNamePtr|
|00002710| 29 3b 0d 09 09 7d 0d 0d | 09 09 69 66 20 28 28 66 |);...}..|..if ((f|
|00002720| 69 6c 65 41 74 74 72 69 | 62 75 74 65 73 20 26 20 |ileAttri|butes & |
|00002730| 28 44 41 54 45 5f 4d 41 | 53 4b 20 7c 20 52 45 53 |(DATE_MA|SK | RES|
|00002740| 4f 55 52 43 45 5f 4d 41 | 53 4b 29 29 20 21 3d 20 |OURCE_MA|SK)) != |
|00002750| 30 29 20 7b 0d 09 09 09 | 64 65 73 74 46 49 6e 66 |0) {....|destFInf|
|00002760| 6f 48 50 61 72 61 6d 42 | 6c 6f 63 6b 2e 66 69 6c |oHParamB|lock.fil|
|00002770| 65 50 61 72 61 6d 2e 69 | 6f 56 52 65 66 4e 75 6d |eParam.i|oVRefNum|
|00002780| 20 3d 20 30 3b 0d 09 09 | 09 64 65 73 74 46 49 6e | = 0;...|.destFIn|
|00002790| 66 6f 48 50 61 72 61 6d | 42 6c 6f 63 6b 2e 66 69 |foHParam|Block.fi|
|000027a0| 6c 65 50 61 72 61 6d 2e | 69 6f 44 69 72 49 44 20 |leParam.|ioDirID |
|000027b0| 3d 20 30 3b 0d 09 09 09 | 69 6f 52 65 73 75 6c 74 |= 0;....|ioResult|
|000027c0| 20 3d 20 50 42 48 53 65 | 74 46 49 6e 66 6f 53 79 | = PBHSe|tFInfoSy|
|000027d0| 6e 63 20 28 26 64 65 73 | 74 46 49 6e 66 6f 48 50 |nc (&des|tFInfoHP|
|000027e0| 61 72 61 6d 42 6c 6f 63 | 6b 29 3b 0d 09 09 09 69 |aramBloc|k);....i|
|000027f0| 66 20 28 69 6f 52 65 73 | 75 6c 74 20 21 3d 20 6e |f (ioRes|ult != n|
|00002800| 6f 45 72 72 29 0d 09 09 | 09 09 45 72 72 6f 72 57 |oErr)...|..ErrorW|
|00002810| 69 74 68 53 74 72 69 6e | 67 41 72 67 75 6d 65 6e |ithStrin|gArgumen|
|00002820| 74 20 28 55 4e 45 58 50 | 45 43 54 45 44 5f 49 4f |t (UNEXP|ECTED_IO|
|00002830| 5f 45 52 52 4f 52 2c 20 | 64 65 73 74 4e 61 6d 65 |_ERROR, |destName|
|00002840| 50 74 72 29 3b 0d 09 09 | 7d 0d 0d 09 7d 0d 7d 0d |Ptr);...|}...}.}.|
|00002850| 23 65 6e 64 69 66 0d 0d | 23 69 66 64 65 66 20 44 |#endif..|#ifdef D|
|00002860| 46 5f 4d 41 43 48 49 4e | 45 5f 57 49 4e 44 4f 57 |F_MACHIN|E_WINDOW|
|00002870| 53 0d 76 6f 69 64 0d 43 | 6f 70 79 46 69 6c 65 41 |S.void.C|opyFileA|
|00002880| 74 74 72 69 62 75 74 65 | 73 20 28 63 6f 6e 73 74 |ttribute|s (const|
|00002890| 20 63 68 61 72 20 2a 73 | 6f 75 72 63 65 4e 61 6d | char *s|ourceNam|
|000028a0| 65 50 74 72 2c 20 63 6f | 6e 73 74 20 63 68 61 72 |ePtr, co|nst char|
|000028b0| 20 2a 64 65 73 74 4e 61 | 6d 65 50 74 72 2c 20 63 | *destNa|mePtr, c|
|000028c0| 6f 6e 73 74 20 69 6e 74 | 20 66 69 6c 65 41 74 74 |onst int| fileAtt|
|000028d0| 72 69 62 75 74 65 73 29 | 0d 7b 0d 09 46 49 4c 45 |ributes)|.{..FILE|
|000028e0| 54 49 4d 45 09 63 72 65 | 61 74 69 6f 6e 54 69 6d |TIME.cre|ationTim|
|000028f0| 65 3b 0d 09 44 57 4f 52 | 44 20 09 09 64 65 73 74 |e;..DWOR|D ..dest|
|00002900| 46 69 6c 65 41 74 74 72 | 69 62 75 74 65 73 3b 0d |FileAttr|ibutes;.|
|00002910| 09 48 41 4e 44 4c 45 20 | 09 09 64 65 73 74 46 69 |.HANDLE |..destFi|
|00002920| 6c 65 48 61 6e 64 6c 65 | 3b 0d 09 46 49 4c 45 54 |leHandle|;..FILET|
|00002930| 49 4d 45 09 6c 61 73 74 | 41 63 63 65 73 73 54 69 |IME.last|AccessTi|
|00002940| 6d 65 3b 0d 09 46 49 4c | 45 54 49 4d 45 09 6c 61 |me;..FIL|ETIME.la|
|00002950| 73 74 57 72 69 74 65 54 | 69 6d 65 3b 0d 09 44 57 |stWriteT|ime;..DW|
|00002960| 4f 52 44 20 09 09 73 6f | 75 72 63 65 46 69 6c 65 |ORD ..so|urceFile|
|00002970| 41 74 74 72 69 62 75 74 | 65 73 3b 0d 09 48 41 4e |Attribut|es;..HAN|
|00002980| 44 4c 45 20 09 09 73 6f | 75 72 63 65 46 69 6c 65 |DLE ..so|urceFile|
|00002990| 48 61 6e 64 6c 65 3b 0d | 0d 09 69 66 20 28 66 69 |Handle;.|..if (fi|
|000029a0| 6c 65 41 74 74 72 69 62 | 75 74 65 73 20 21 3d 20 |leAttrib|utes != |
|000029b0| 30 29 20 7b 0d 09 09 69 | 66 20 28 28 66 69 6c 65 |0) {...i|f ((file|
|000029c0| 41 74 74 72 69 62 75 74 | 65 73 20 26 20 44 41 54 |Attribut|es & DAT|
|000029d0| 45 5f 4d 41 53 4b 29 20 | 21 3d 20 30 29 20 7b 0d |E_MASK) |!= 0) {.|
|000029e0| 09 09 09 73 6f 75 72 63 | 65 46 69 6c 65 48 61 6e |...sourc|eFileHan|
|000029f0| 64 6c 65 20 3d 20 43 72 | 65 61 74 65 46 69 6c 65 |dle = Cr|eateFile|
|00002a00| 28 73 6f 75 72 63 65 4e | 61 6d 65 50 74 72 2c 09 |(sourceN|amePtr,.|
|00002a10| 09 09 09 09 09 09 09 2f | 2a 20 66 69 6c 65 20 6e |......./|* file n|
|00002a20| 61 6d 65 20 70 6f 69 6e | 74 65 72 20 20 2a 2f 0d |ame poin|ter */.|
|00002a30| 20 20 20 20 09 09 09 09 | 09 09 09 09 09 09 09 09 | ....|........|
|00002a40| 09 09 09 09 47 45 4e 45 | 52 49 43 5f 52 45 41 44 |....GENE|RIC_READ|
|00002a50| 2c 09 09 09 09 09 09 09 | 09 09 2f 2a 20 6f 70 65 |,.......|../* ope|
|00002a60| 6e 20 66 6f 72 20 72 65 | 61 64 69 6e 67 20 20 20 |n for re|ading |
|00002a70| 2a 2f 0d 20 20 20 20 09 | 09 09 09 09 09 09 09 09 |*/. .|........|
|00002a80| 09 09 09 09 09 09 09 46 | 49 4c 45 5f 53 48 41 52 |.......F|ILE_SHAR|
|00002a90| 45 5f 52 45 41 44 2c 20 | 20 20 20 20 20 20 20 20 |E_READ, | |
|00002aa0| 20 20 20 20 20 2f 2a 20 | 73 68 61 72 65 20 72 65 | /* |share re|
|00002ab0| 61 64 73 09 09 09 09 2a | 2f 0d 09 09 09 09 09 09 |ads....*|/.......|
|00002ac0| 09 09 09 09 09 09 09 09 | 09 09 20 20 20 20 28 4c |........|.. (L|
|00002ad0| 50 53 45 43 55 52 49 54 | 59 5f 41 54 54 52 49 42 |PSECURIT|Y_ATTRIB|
|00002ae0| 55 54 45 53 29 20 4e 55 | 4c 4c 2c 20 2f 2a 20 6e |UTES) NU|LL, /* n|
|00002af0| 6f 20 73 65 63 75 72 69 | 74 79 20 20 20 20 20 20 |o securi|ty |
|00002b00| 20 20 2a 2f 0d 09 09 09 | 09 09 09 09 09 09 09 09 | */....|........|
|00002b10| 09 09 09 09 09 20 20 20 | 20 4f 50 45 4e 5f 45 58 |..... | OPEN_EX|
|00002b20| 49 53 54 49 4e 47 2c 20 | 20 20 20 20 20 20 20 20 |ISTING, | |
|00002b30| 20 20 20 20 20 20 20 2f | 2a 20 65 78 69 73 74 69 | /|* existi|
|00002b40| 6e 67 20 66 69 6c 65 20 | 6f 6e 6c 79 20 2a 2f 0d |ng file |only */.|
|00002b50| 09 09 09 09 09 09 09 09 | 09 09 09 09 09 09 09 09 |........|........|
|00002b60| 20 20 20 20 46 49 4c 45 | 5f 41 54 54 52 49 42 55 | FILE|_ATTRIBU|
|00002b70| 54 45 5f 4e 4f 52 4d 41 | 4c 2c 20 20 20 20 20 20 |TE_NORMA|L, |
|00002b80| 20 20 2f 2a 20 6e 6f 72 | 6d 61 6c 20 66 69 6c 65 | /* nor|mal file|
|00002b90| 20 20 20 20 20 20 20 20 | 2a 2f 0d 20 20 20 20 20 | |*/. |
|00002ba0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00002bb0| 20 20 20 20 20 20 20 20 | 20 09 20 20 20 20 28 48 | | . (H|
|00002bc0| 41 4e 44 4c 45 29 20 4e | 55 4c 4c 29 3b 20 20 20 |ANDLE) N|ULL); |
|00002bd0| 20 20 20 20 20 20 20 20 | 20 20 20 20 2f 2a 20 6e | | /* n|
|00002be0| 6f 20 61 74 74 72 2e 20 | 74 65 6d 70 6c 61 74 65 |o attr. |template|
|00002bf0| 20 20 2a 2f 0d 09 09 09 | 69 66 20 28 73 6f 75 72 | */....|if (sour|
|00002c00| 63 65 46 69 6c 65 48 61 | 6e 64 6c 65 20 3d 3d 20 |ceFileHa|ndle == |
|00002c10| 49 4e 56 41 4c 49 44 5f | 48 41 4e 44 4c 45 5f 56 |INVALID_|HANDLE_V|
|00002c20| 41 4c 55 45 29 0d 09 09 | 09 09 45 72 72 6f 72 57 |ALUE)...|..ErrorW|
|00002c30| 69 74 68 53 74 72 69 6e | 67 41 72 67 75 6d 65 6e |ithStrin|gArgumen|
|00002c40| 74 20 28 55 4e 45 58 50 | 45 43 54 45 44 5f 49 4f |t (UNEXP|ECTED_IO|
|00002c50| 5f 45 52 52 4f 52 2c 20 | 73 6f 75 72 63 65 4e 61 |_ERROR, |sourceNa|
|00002c60| 6d 65 50 74 72 29 3b 0d | 09 09 09 69 66 20 28 21 |mePtr);.|...if (!|
|00002c70| 47 65 74 46 69 6c 65 54 | 69 6d 65 20 28 73 6f 75 |GetFileT|ime (sou|
|00002c80| 72 63 65 46 69 6c 65 48 | 61 6e 64 6c 65 2c 20 26 |rceFileH|andle, &|
|00002c90| 63 72 65 61 74 69 6f 6e | 54 69 6d 65 2c 0d 09 09 |creation|Time,...|
|00002ca0| 09 09 09 09 09 09 09 09 | 09 09 09 09 09 09 09 09 |........|........|
|00002cb0| 09 09 09 26 6c 61 73 74 | 41 63 63 65 73 73 54 69 |...&last|AccessTi|
|00002cc0| 6d 65 2c 0d 09 09 09 09 | 09 09 09 09 09 09 09 09 |me,.....|........|
|00002cd0| 09 09 09 09 09 09 09 09 | 09 26 6c 61 73 74 57 72 |........|.&lastWr|
|00002ce0| 69 74 65 54 69 6d 65 29 | 29 0d 09 09 09 09 45 72 |iteTime)|).....Er|
|00002cf0| 72 6f 72 57 69 74 68 53 | 74 72 69 6e 67 41 72 67 |rorWithS|tringArg|
|00002d00| 75 6d 65 6e 74 20 28 55 | 4e 45 58 50 45 43 54 45 |ument (U|NEXPECTE|
|00002d10| 44 5f 49 4f 5f 45 52 52 | 4f 52 2c 20 73 6f 75 72 |D_IO_ERR|OR, sour|
|00002d20| 63 65 4e 61 6d 65 50 74 | 72 29 3b 0d 09 09 09 69 |ceNamePt|r);....i|
|00002d30| 66 20 28 21 43 6c 6f 73 | 65 48 61 6e 64 6c 65 20 |f (!Clos|eHandle |
|00002d40| 28 73 6f 75 72 63 65 46 | 69 6c 65 48 61 6e 64 6c |(sourceF|ileHandl|
|00002d50| 65 29 29 0d 09 09 09 09 | 45 72 72 6f 72 57 69 74 |e)).....|ErrorWit|
|00002d60| 68 53 74 72 69 6e 67 41 | 72 67 75 6d 65 6e 74 20 |hStringA|rgument |
|00002d70| 28 55 4e 45 58 50 45 43 | 54 45 44 5f 49 4f 5f 45 |(UNEXPEC|TED_IO_E|
|00002d80| 52 52 4f 52 2c 20 73 6f | 75 72 63 65 4e 61 6d 65 |RROR, so|urceName|
|00002d90| 50 74 72 29 3b 0d 09 09 | 09 64 65 73 74 46 69 6c |Ptr);...|.destFil|
|00002da0| 65 48 61 6e 64 6c 65 20 | 3d 20 43 72 65 61 74 65 |eHandle |= Create|
|00002db0| 46 69 6c 65 20 28 64 65 | 73 74 4e 61 6d 65 50 74 |File (de|stNamePt|
|00002dc0| 72 2c 09 09 09 09 09 09 | 09 09 09 20 2f 2a 20 66 |r,......|... /* f|
|00002dd0| 69 6c 65 20 6e 61 6d 65 | 20 70 6f 69 6e 74 65 72 |ile name| pointer|
|00002de0| 20 20 2a 2f 0d 20 20 20 | 20 09 09 09 09 09 09 09 | */. | .......|
|00002df0| 09 09 09 09 09 09 09 09 | 20 47 45 4e 45 52 49 43 |........| GENERIC|
|00002e00| 5f 57 52 49 54 45 2c 09 | 09 09 09 09 09 09 09 20 |_WRITE,.|....... |
|00002e10| 2f 2a 20 6f 70 65 6e 20 | 66 6f 72 20 77 72 69 74 |/* open |for writ|
|00002e20| 69 6e 67 20 20 20 2a 2f | 0d 20 20 20 20 09 09 09 |ing */|. ...|
|00002e30| 09 09 09 09 09 09 09 09 | 09 09 09 09 20 46 49 4c |........|.... FIL|
|00002e40| 45 5f 53 48 41 52 45 5f | 57 52 49 54 45 2c 20 20 |E_SHARE_|WRITE, |
|00002e50| 20 20 20 20 20 20 20 20 | 20 20 20 2f 2a 20 73 68 | | /* sh|
|00002e60| 61 72 65 20 77 72 69 74 | 65 73 20 20 20 20 20 20 |are writ|es |
|00002e70| 20 2a 2f 0d 09 09 09 09 | 09 09 09 09 09 09 09 09 | */.....|........|
|00002e80| 09 09 09 09 20 20 20 28 | 4c 50 53 45 43 55 52 49 |.... (|LPSECURI|
|00002e90| 54 59 5f 41 54 54 52 49 | 42 55 54 45 53 29 20 4e |TY_ATTRI|BUTES) N|
|00002ea0| 55 4c 4c 2c 20 2f 2a 20 | 6e 6f 20 73 65 63 75 72 |ULL, /* |no secur|
|00002eb0| 69 74 79 20 20 20 20 20 | 20 20 20 2a 2f 0d 09 09 |ity | */...|
|00002ec0| 09 09 09 09 09 09 09 09 | 09 09 09 09 09 09 20 20 |........|...... |
|00002ed0| 20 4f 50 45 4e 5f 45 58 | 49 53 54 49 4e 47 2c 20 | OPEN_EX|ISTING, |
|00002ee0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 2f | | /|
|00002ef0| 2a 20 65 78 69 73 74 69 | 6e 67 20 66 69 6c 65 20 |* existi|ng file |
|00002f00| 6f 6e 6c 79 20 2a 2f 0d | 09 09 09 09 09 09 09 09 |only */.|........|
|00002f10| 09 09 09 09 09 09 09 09 | 20 20 20 46 49 4c 45 5f |........| FILE_|
|00002f20| 41 54 54 52 49 42 55 54 | 45 5f 4e 4f 52 4d 41 4c |ATTRIBUT|E_NORMAL|
|00002f30| 2c 20 20 20 20 20 20 20 | 20 2f 2a 20 6e 6f 72 6d |, | /* norm|
|00002f40| 61 6c 20 66 69 6c 65 20 | 20 20 20 20 20 20 20 2a |al file | *|
|00002f50| 2f 0d 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 |/. | |
|00002f60| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00002f70| 09 20 20 20 28 48 41 4e | 44 4c 45 29 20 4e 55 4c |. (HAN|DLE) NUL|
|00002f80| 4c 29 3b 20 20 20 20 20 | 20 20 20 20 20 20 20 20 |L); | |
|00002f90| 20 20 2f 2a 20 6e 6f 20 | 61 74 74 72 2e 20 74 65 | /* no |attr. te|
|00002fa0| 6d 70 6c 61 74 65 20 20 | 2a 2f 0d 09 09 09 69 66 |mplate |*/....if|
|00002fb0| 20 28 64 65 73 74 46 69 | 6c 65 48 61 6e 64 6c 65 | (destFi|leHandle|
|00002fc0| 20 3d 3d 20 49 4e 56 41 | 4c 49 44 5f 48 41 4e 44 | == INVA|LID_HAND|
|00002fd0| 4c 45 5f 56 41 4c 55 45 | 29 0d 09 09 09 09 45 72 |LE_VALUE|).....Er|
|00002fe0| 72 6f 72 57 69 74 68 53 | 74 72 69 6e 67 41 72 67 |rorWithS|tringArg|
|00002ff0| 75 6d 65 6e 74 20 28 55 | 4e 45 58 50 45 43 54 45 |ument (U|NEXPECTE|
|00003000| 44 5f 49 4f 5f 45 52 52 | 4f 52 2c 20 73 6f 75 72 |D_IO_ERR|OR, sour|
|00003010| 63 65 4e 61 6d 65 50 74 | 72 29 3b 0d 09 09 09 69 |ceNamePt|r);....i|
|00003020| 66 20 28 21 53 65 74 46 | 69 6c 65 54 69 6d 65 20 |f (!SetF|ileTime |
|00003030| 28 64 65 73 74 46 69 6c | 65 48 61 6e 64 6c 65 2c |(destFil|eHandle,|
|00003040| 20 26 63 72 65 61 74 69 | 6f 6e 54 69 6d 65 2c 0d | &creati|onTime,.|
|00003050| 09 09 09 09 09 09 09 09 | 09 09 09 09 09 09 09 09 |........|........|
|00003060| 09 09 09 09 26 6c 61 73 | 74 41 63 63 65 73 73 54 |....&las|tAccessT|
|00003070| 69 6d 65 2c 0d 09 09 09 | 09 09 09 09 09 09 09 09 |ime,....|........|
|00003080| 09 09 09 09 09 09 09 09 | 09 26 6c 61 73 74 57 72 |........|.&lastWr|
|00003090| 69 74 65 54 69 6d 65 29 | 29 0d 09 09 09 09 45 72 |iteTime)|).....Er|
|000030a0| 72 6f 72 57 69 74 68 53 | 74 72 69 6e 67 41 72 67 |rorWithS|tringArg|
|000030b0| 75 6d 65 6e 74 20 28 55 | 4e 45 58 50 45 43 54 45 |ument (U|NEXPECTE|
|000030c0| 44 5f 49 4f 5f 45 52 52 | 4f 52 2c 20 64 65 73 74 |D_IO_ERR|OR, dest|
|000030d0| 4e 61 6d 65 50 74 72 29 | 3b 0d 09 09 09 69 66 20 |NamePtr)|;....if |
|000030e0| 28 21 43 6c 6f 73 65 48 | 61 6e 64 6c 65 20 28 64 |(!CloseH|andle (d|
|000030f0| 65 73 74 46 69 6c 65 48 | 61 6e 64 6c 65 29 29 0d |estFileH|andle)).|
|00003100| 09 09 09 09 45 72 72 6f | 72 57 69 74 68 53 74 72 |....Erro|rWithStr|
|00003110| 69 6e 67 41 72 67 75 6d | 65 6e 74 20 28 55 4e 45 |ingArgum|ent (UNE|
|00003120| 58 50 45 43 54 45 44 5f | 49 4f 5f 45 52 52 4f 52 |XPECTED_|IO_ERROR|
|00003130| 2c 20 64 65 73 74 46 69 | 6c 65 48 61 6e 64 6c 65 |, destFi|leHandle|
|00003140| 29 3b 0d 20 09 09 7d 0d | 0d 09 09 69 66 20 28 28 |);. ..}.|...if ((|
|00003150| 66 69 6c 65 41 74 74 72 | 69 62 75 74 65 73 20 26 |fileAttr|ibutes &|
|00003160| 20 28 4c 4f 43 4b 5f 4d | 41 53 4b 20 2b 20 52 45 | (LOCK_M|ASK + RE|
|00003170| 53 4f 55 52 43 45 5f 4d | 41 53 4b 29 29 20 21 3d |SOURCE_M|ASK)) !=|
|00003180| 20 30 29 20 7b 0d 09 09 | 09 64 65 73 74 46 69 6c | 0) {...|.destFil|
|00003190| 65 41 74 74 72 69 62 75 | 74 65 73 20 3d 20 47 65 |eAttribu|tes = Ge|
|000031a0| 74 46 69 6c 65 41 74 74 | 72 69 62 75 74 65 73 20 |tFileAtt|ributes |
|000031b0| 28 64 65 73 74 4e 61 6d | 65 50 74 72 29 3b 0d 09 |(destNam|ePtr);..|
|000031c0| 09 09 69 66 20 28 64 65 | 73 74 46 69 6c 65 41 74 |..if (de|stFileAt|
|000031d0| 74 72 69 62 75 74 65 73 | 20 3d 3d 20 2d 31 29 0d |tributes| == -1).|
|000031e0| 09 09 09 09 45 72 72 6f | 72 57 69 74 68 53 74 72 |....Erro|rWithStr|
|000031f0| 69 6e 67 41 72 67 75 6d | 65 6e 74 20 28 55 4e 45 |ingArgum|ent (UNE|
|00003200| 58 50 45 43 54 45 44 5f | 49 4f 5f 45 52 52 4f 52 |XPECTED_|IO_ERROR|
|00003210| 2c 20 64 65 73 74 4e 61 | 6d 65 50 74 72 29 3b 0d |, destNa|mePtr);.|
|00003220| 09 09 09 69 66 20 28 28 | 66 69 6c 65 41 74 74 72 |...if ((|fileAttr|
|00003230| 69 62 75 74 65 73 20 26 | 20 52 45 53 4f 55 52 43 |ibutes &| RESOURC|
|00003240| 45 5f 4d 41 53 4b 29 20 | 21 3d 20 30 29 20 7b 0d |E_MASK) |!= 0) {.|
|00003250| 09 09 09 09 73 6f 75 72 | 63 65 46 69 6c 65 41 74 |....sour|ceFileAt|
|00003260| 74 72 69 62 75 74 65 73 | 20 3d 20 47 65 74 46 69 |tributes| = GetFi|
|00003270| 6c 65 41 74 74 72 69 62 | 75 74 65 73 20 28 73 6f |leAttrib|utes (so|
|00003280| 75 72 63 65 4e 61 6d 65 | 50 74 72 29 3b 0d 09 09 |urceName|Ptr);...|
|00003290| 09 09 69 66 20 28 73 6f | 75 72 63 65 46 69 6c 65 |..if (so|urceFile|
|000032a0| 41 74 74 72 69 62 75 74 | 65 73 20 21 3d 20 2d 31 |Attribut|es != -1|
|000032b0| 29 0d 09 09 09 09 09 64 | 65 73 74 46 69 6c 65 41 |)......d|estFileA|
|000032c0| 74 74 72 69 62 75 74 65 | 73 20 3d 0d 09 09 09 09 |ttribute|s =.....|
|000032d0| 09 09 28 64 65 73 74 46 | 69 6c 65 41 74 74 72 69 |..(destF|ileAttri|
|000032e0| 62 75 74 65 73 20 26 20 | 7e 28 46 49 4c 45 5f 41 |butes & |~(FILE_A|
|000032f0| 54 54 52 49 42 55 54 45 | 5f 48 49 44 44 45 4e 20 |TTRIBUTE|_HIDDEN |
|00003300| 7c 20 46 49 4c 45 5f 41 | 54 54 52 49 42 55 54 45 || FILE_A|TTRIBUTE|
|00003310| 5f 53 59 53 54 45 4d 29 | 29 20 7c 0d 09 09 09 09 |_SYSTEM)|) |.....|
|00003320| 09 09 28 73 6f 75 72 63 | 65 46 69 6c 65 41 74 74 |..(sourc|eFileAtt|
|00003330| 72 69 62 75 74 65 73 20 | 26 20 28 46 49 4c 45 5f |ributes |& (FILE_|
|00003340| 41 54 54 52 49 42 55 54 | 45 5f 48 49 44 44 45 4e |ATTRIBUT|E_HIDDEN|
|00003350| 20 7c 20 46 49 4c 45 5f | 41 54 54 52 49 42 55 54 | | FILE_|ATTRIBUT|
|00003360| 45 5f 53 59 53 54 45 4d | 29 29 3b 0d 09 09 09 7d |E_SYSTEM|));....}|
|00003370| 0d 09 09 09 69 66 20 28 | 28 66 69 6c 65 41 74 74 |....if (|(fileAtt|
|00003380| 72 69 62 75 74 65 73 20 | 26 20 4c 4f 43 4b 5f 4d |ributes |& LOCK_M|
|00003390| 41 53 4b 29 20 21 3d 20 | 30 29 0d 09 09 09 09 64 |ASK) != |0).....d|
|000033a0| 65 73 74 46 69 6c 65 41 | 74 74 72 69 62 75 74 65 |estFileA|ttribute|
|000033b0| 73 20 7c 3d 20 46 49 4c | 45 5f 41 54 54 52 49 42 |s |= FIL|E_ATTRIB|
|000033c0| 55 54 45 5f 52 45 41 44 | 4f 4e 4c 59 3b 0d 09 09 |UTE_READ|ONLY;...|
|000033d0| 09 69 66 20 28 21 53 65 | 74 46 69 6c 65 41 74 74 |.if (!Se|tFileAtt|
|000033e0| 72 69 62 75 74 65 73 20 | 28 64 65 73 74 4e 61 6d |ributes |(destNam|
|000033f0| 65 50 74 72 2c 20 64 65 | 73 74 46 69 6c 65 41 74 |ePtr, de|stFileAt|
|00003400| 74 72 69 62 75 74 65 73 | 29 29 0d 09 09 09 09 45 |tributes|)).....E|
|00003410| 72 72 6f 72 57 69 74 68 | 53 74 72 69 6e 67 41 72 |rrorWith|StringAr|
|00003420| 67 75 6d 65 6e 74 20 28 | 55 4e 45 58 50 45 43 54 |gument (|UNEXPECT|
|00003430| 45 44 5f 49 4f 5f 45 52 | 52 4f 52 2c 20 64 65 73 |ED_IO_ER|ROR, des|
|00003440| 74 4e 61 6d 65 50 74 72 | 29 3b 0d 09 09 7d 0d 09 |tNamePtr|);...}..|
|00003450| 7d 0d 7d 0d 23 65 6e 64 | 69 66 0d 0d 23 69 66 64 |}.}.#end|if..#ifd|
|00003460| 65 66 20 44 46 5f 4d 41 | 43 48 49 4e 45 5f 4e 45 |ef DF_MA|CHINE_NE|
|00003470| 58 54 0d 76 6f 69 64 0d | 43 6f 70 79 46 69 6c 65 |XT.void.|CopyFile|
|00003480| 41 74 74 72 69 62 75 74 | 65 73 20 28 63 6f 6e 73 |Attribut|es (cons|
|00003490| 74 20 63 68 61 72 20 2a | 73 6f 75 72 63 65 4e 61 |t char *|sourceNa|
|000034a0| 6d 65 50 74 72 2c 20 63 | 6f 6e 73 74 20 63 68 61 |mePtr, c|onst cha|
|000034b0| 72 20 2a 64 65 73 74 4e | 61 6d 65 50 74 72 2c 20 |r *destN|amePtr, |
|000034c0| 63 6f 6e 73 74 20 69 6e | 74 20 66 69 6c 65 41 74 |const in|t fileAt|
|000034d0| 74 72 69 62 75 74 65 73 | 29 0d 7b 0d 09 73 74 72 |tributes|).{..str|
|000034e0| 75 63 74 20 73 74 61 74 | 20 09 09 64 65 73 74 53 |uct stat| ..destS|
|000034f0| 74 61 74 42 75 66 66 65 | 72 3b 0d 09 69 6e 74 20 |tatBuffe|r;..int |
|00003500| 09 09 09 09 09 09 69 6f | 52 65 73 75 6c 74 3b 0d |......io|Result;.|
|00003510| 09 69 6e 74 20 09 09 09 | 09 09 09 73 6f 75 72 63 |.int ...|...sourc|
|00003520| 65 49 4f 52 65 73 75 6c | 74 3b 0d 20 20 73 74 72 |eIOResul|t;. str|
|00003530| 75 63 74 20 74 69 6d 65 | 76 61 6c 09 74 69 6d 65 |uct time|val.time|
|00003540| 56 61 6c 75 65 5b 32 5d | 3b 0d 09 73 74 72 75 63 |Value[2]|;..struc|
|00003550| 74 20 73 74 61 74 20 09 | 09 73 6f 75 72 63 65 53 |t stat .|.sourceS|
|00003560| 74 61 74 42 75 66 66 65 | 72 3b 0d 0d 09 69 66 20 |tatBuffe|r;...if |
|00003570| 28 66 69 6c 65 41 74 74 | 72 69 62 75 74 65 73 20 |(fileAtt|ributes |
|00003580| 21 3d 20 30 29 20 7b 0d | 09 09 73 6f 75 72 63 65 |!= 0) {.|..source|
|00003590| 49 4f 52 65 73 75 6c 74 | 20 3d 20 30 3b 0d 09 09 |IOResult| = 0;...|
|000035a0| 69 66 20 28 28 66 69 6c | 65 41 74 74 72 69 62 75 |if ((fil|eAttribu|
|000035b0| 74 65 73 20 26 20 28 4c | 4f 43 4b 5f 4d 41 53 4b |tes & (L|OCK_MASK|
|000035c0| 20 2b 20 52 45 53 4f 55 | 52 43 45 5f 4d 41 53 4b | + RESOU|RCE_MASK|
|000035d0| 29 29 20 21 3d 20 30 29 | 20 7b 0d 09 09 09 69 6f |)) != 0)| {....io|
|000035e0| 52 65 73 75 6c 74 20 3d | 20 73 74 61 74 28 64 65 |Result =| stat(de|
|000035f0| 73 74 4e 61 6d 65 50 74 | 72 2c 20 26 64 65 73 74 |stNamePt|r, &dest|
|00003600| 53 74 61 74 42 75 66 66 | 65 72 29 3b 0d 09 09 09 |StatBuff|er);....|
|00003610| 69 66 20 28 69 6f 52 65 | 73 75 6c 74 20 21 3d 20 |if (ioRe|sult != |
|00003620| 30 29 0d 09 09 09 09 45 | 72 72 6f 72 57 69 74 68 |0).....E|rrorWith|
|00003630| 53 74 72 69 6e 67 41 72 | 67 75 6d 65 6e 74 20 28 |StringAr|gument (|
|00003640| 55 4e 45 58 50 45 43 54 | 45 44 5f 49 4f 5f 45 52 |UNEXPECT|ED_IO_ER|
|00003650| 52 4f 52 2c 20 64 65 73 | 74 4e 61 6d 65 50 74 72 |ROR, des|tNamePtr|
|00003660| 29 3b 0d 09 09 7d 0d 0d | 09 09 69 66 20 28 28 66 |);...}..|..if ((f|
|00003670| 69 6c 65 41 74 74 72 69 | 62 75 74 65 73 20 26 20 |ileAttri|butes & |
|00003680| 28 44 41 54 45 5f 4d 41 | 53 4b 20 2b 20 52 45 53 |(DATE_MA|SK + RES|
|00003690| 4f 55 52 43 45 5f 4d 41 | 53 4b 29 29 20 21 3d 20 |OURCE_MA|SK)) != |
|000036a0| 30 29 0d 09 09 09 73 6f | 75 72 63 65 49 4f 52 65 |0)....so|urceIORe|
|000036b0| 73 75 6c 74 20 3d 20 73 | 74 61 74 28 73 6f 75 72 |sult = s|tat(sour|
|000036c0| 63 65 4e 61 6d 65 50 74 | 72 2c 20 26 73 6f 75 72 |ceNamePt|r, &sour|
|000036d0| 63 65 53 74 61 74 42 75 | 66 66 65 72 29 3b 0d 0d |ceStatBu|ffer);..|
|000036e0| 09 09 69 66 20 28 73 6f | 75 72 63 65 49 4f 52 65 |..if (so|urceIORe|
|000036f0| 73 75 6c 74 20 3d 3d 20 | 30 20 26 26 20 28 66 69 |sult == |0 && (fi|
|00003700| 6c 65 41 74 74 72 69 62 | 75 74 65 73 20 26 20 52 |leAttrib|utes & R|
|00003710| 45 53 4f 55 52 43 45 5f | 4d 41 53 4b 29 20 21 3d |ESOURCE_|MASK) !=|
|00003720| 20 30 29 0d 09 09 09 64 | 65 73 74 53 74 61 74 42 | 0)....d|estStatB|
|00003730| 75 66 66 65 72 2e 73 74 | 5f 6d 6f 64 65 20 3d 20 |uffer.st|_mode = |
|00003740| 28 64 65 73 74 53 74 61 | 74 42 75 66 66 65 72 2e |(destSta|tBuffer.|
|00003750| 73 74 5f 6d 6f 64 65 20 | 26 20 7e 30 31 31 31 29 |st_mode |& ~0111)|
|00003760| 20 2b 20 28 73 6f 75 72 | 63 65 53 74 61 74 42 75 | + (sour|ceStatBu|
|00003770| 66 66 65 72 2e 73 74 5f | 6d 6f 64 65 20 26 20 30 |ffer.st_|mode & 0|
|00003780| 31 31 31 29 3b 0d 0d 09 | 09 69 66 20 28 28 66 69 |111);...|.if ((fi|
|00003790| 6c 65 41 74 74 72 69 62 | 75 74 65 73 20 26 20 4c |leAttrib|utes & L|
|000037a0| 4f 43 4b 5f 4d 41 53 4b | 29 20 21 3d 20 30 29 0d |OCK_MASK|) != 0).|
|000037b0| 09 09 09 64 65 73 74 53 | 74 61 74 42 75 66 66 65 |...destS|tatBuffe|
|000037c0| 72 2e 73 74 5f 6d 6f 64 | 65 20 26 3d 20 7e 30 32 |r.st_mod|e &= ~02|
|000037d0| 32 32 3b 0d 0d 09 09 69 | 66 20 28 73 6f 75 72 63 |22;....i|f (sourc|
|000037e0| 65 49 4f 52 65 73 75 6c | 74 20 3d 3d 20 30 20 26 |eIOResul|t == 0 &|
|000037f0| 26 20 28 66 69 6c 65 41 | 74 74 72 69 62 75 74 65 |& (fileA|ttribute|
|00003800| 73 20 26 20 44 41 54 45 | 5f 4d 41 53 4b 29 20 21 |s & DATE|_MASK) !|
|00003810| 3d 20 30 29 20 7b 0d 09 | 09 09 74 69 6d 65 56 61 |= 0) {..|..timeVa|
|00003820| 6c 75 65 5b 30 5d 2e 74 | 76 5f 73 65 63 20 3d 20 |lue[0].t|v_sec = |
|00003830| 73 6f 75 72 63 65 53 74 | 61 74 42 75 66 66 65 72 |sourceSt|atBuffer|
|00003840| 2e 73 74 5f 61 74 69 6d | 65 3b 0d 09 09 09 74 69 |.st_atim|e;....ti|
|00003850| 6d 65 56 61 6c 75 65 5b | 30 5d 2e 74 76 5f 75 73 |meValue[|0].tv_us|
|00003860| 65 63 20 3d 20 30 3b 0d | 09 09 09 74 69 6d 65 56 |ec = 0;.|...timeV|
|00003870| 61 6c 75 65 5b 31 5d 2e | 74 76 5f 73 65 63 20 3d |alue[1].|tv_sec =|
|00003880| 20 73 6f 75 72 63 65 53 | 74 61 74 42 75 66 66 65 | sourceS|tatBuffe|
|00003890| 72 2e 73 74 5f 6d 74 69 | 6d 65 3b 0d 09 09 09 74 |r.st_mti|me;....t|
|000038a0| 69 6d 65 56 61 6c 75 65 | 5b 31 5d 2e 74 76 5f 75 |imeValue|[1].tv_u|
|000038b0| 73 65 63 20 3d 20 30 3b | 0d 09 20 20 09 69 6f 52 |sec = 0;|.. .ioR|
|000038c0| 65 73 75 6c 74 20 3d 20 | 75 74 69 6d 65 73 20 28 |esult = |utimes (|
|000038d0| 64 65 73 74 4e 61 6d 65 | 50 74 72 2c 20 74 69 6d |destName|Ptr, tim|
|000038e0| 65 56 61 6c 75 65 29 3b | 0d 09 09 09 69 66 20 28 |eValue);|....if (|
|000038f0| 69 6f 52 65 73 75 6c 74 | 20 21 3d 20 30 29 0d 09 |ioResult| != 0)..|
|00003900| 09 09 09 45 72 72 6f 72 | 57 69 74 68 53 74 72 69 |...Error|WithStri|
|00003910| 6e 67 41 72 67 75 6d 65 | 6e 74 20 28 55 4e 45 58 |ngArgume|nt (UNEX|
|00003920| 50 45 43 54 45 44 5f 49 | 4f 5f 45 52 52 4f 52 2c |PECTED_I|O_ERROR,|
|00003930| 20 64 65 73 74 4e 61 6d | 65 50 74 72 29 3b 0d 09 | destNam|ePtr);..|
|00003940| 09 7d 0d 0d 09 09 69 66 | 20 28 28 66 69 6c 65 41 |.}....if| ((fileA|
|00003950| 74 74 72 69 62 75 74 65 | 73 20 26 20 28 4c 4f 43 |ttribute|s & (LOC|
|00003960| 4b 5f 4d 41 53 4b 20 2b | 20 52 45 53 4f 55 52 43 |K_MASK +| RESOURC|
|00003970| 45 5f 4d 41 53 4b 29 29 | 20 21 3d 20 30 29 20 7b |E_MASK))| != 0) {|
|00003980| 0d 09 09 09 69 6f 52 65 | 73 75 6c 74 20 3d 20 63 |....ioRe|sult = c|
|00003990| 68 6d 6f 64 20 28 64 65 | 73 74 4e 61 6d 65 50 74 |hmod (de|stNamePt|
|000039a0| 72 2c 20 64 65 73 74 53 | 74 61 74 42 75 66 66 65 |r, destS|tatBuffe|
|000039b0| 72 2e 73 74 5f 6d 6f 64 | 65 29 3b 0d 09 09 09 69 |r.st_mod|e);....i|
|000039c0| 66 20 28 69 6f 52 65 73 | 75 6c 74 20 21 3d 20 30 |f (ioRes|ult != 0|
|000039d0| 29 0d 09 09 09 09 45 72 | 72 6f 72 57 69 74 68 53 |).....Er|rorWithS|
|000039e0| 74 72 69 6e 67 41 72 67 | 75 6d 65 6e 74 20 28 55 |tringArg|ument (U|
|000039f0| 4e 45 58 50 45 43 54 45 | 44 5f 49 4f 5f 45 52 52 |NEXPECTE|D_IO_ERR|
|00003a00| 4f 52 2c 20 64 65 73 74 | 4e 61 6d 65 50 74 72 29 |OR, dest|NamePtr)|
|00003a10| 3b 0d 09 09 7d 0d 09 7d | 0d 7d 0d 23 65 6e 64 69 |;...}..}|.}.#endi|
|00003a20| 66 0d 0d 46 49 4c 45 20 | 2a 0d 43 72 65 61 74 65 |f..FILE |*.Create|
|00003a30| 54 79 70 65 64 46 69 6c | 65 20 28 63 6f 6e 73 74 |TypedFil|e (const|
|00003a40| 20 63 68 61 72 20 2a 70 | 61 74 68 43 68 61 72 50 | char *p|athCharP|
|00003a50| 74 72 2c 20 69 6e 74 20 | 62 69 6e 61 72 79 29 0d |tr, int |binary).|
|00003a60| 20 2f 2a 0d 09 2a 20 49 | 74 20 69 73 20 77 65 6c | /*..* I|t is wel|
|00003a70| 6c 20 6b 6e 6f 77 6e 20 | 74 68 61 74 20 67 65 74 |l known |that get|
|00003a80| 74 69 6e 67 20 61 6e 64 | 20 73 65 74 74 69 6e 67 |ting and| setting|
|00003a90| 20 74 68 65 20 66 69 6c | 65 20 74 79 70 65 20 61 | the fil|e type a|
|00003aa0| 66 74 65 72 20 63 72 65 | 61 74 69 6e 67 20 74 68 |fter cre|ating th|
|00003ab0| 65 20 66 69 6c 65 0d 09 | 2a 20 69 73 20 6e 6f 6e |e file..|* is non|
|00003ac0| 2d 61 74 6f 6d 69 63 20 | 61 6e 64 20 73 75 66 66 |-atomic |and suff|
|00003ad0| 65 72 73 20 66 72 6f 6d | 20 70 6f 74 65 6e 74 69 |ers from| potenti|
|00003ae0| 61 6c 20 72 61 63 65 20 | 63 6f 6e 64 69 74 69 6f |al race |conditio|
|00003af0| 6e 73 2e 20 20 54 68 65 | 72 65 20 69 73 20 6e 6f |ns. The|re is no|
|00003b00| 0d 09 2a 20 61 6c 74 65 | 72 6e 61 74 69 76 65 20 |..* alte|rnative |
|00003b10| 62 65 63 61 75 73 65 20 | 77 65 20 61 72 65 20 72 |because |we are r|
|00003b20| 65 71 75 69 72 65 64 20 | 74 6f 20 72 65 74 75 72 |equired |to retur|
|00003b30| 6e 20 61 20 46 49 4c 45 | 20 2a 2e 0d 09 2a 2f 0d |n a FILE| *...*/.|
|00003b40| 7b 0d 09 63 68 61 72 09 | 09 09 09 09 09 20 2a 66 |{..char.|..... *f|
|00003b50| 69 6c 65 4d 6f 64 65 43 | 68 61 72 50 74 72 3b 0d |ileModeC|harPtr;.|
|00003b60| 09 46 49 4c 45 09 09 09 | 09 09 09 20 2a 66 69 6c |.FILE...|... *fil|
|00003b70| 65 50 74 72 3b 0d 09 23 | 69 66 64 65 66 20 44 46 |ePtr;..#|ifdef DF|
|00003b80| 5f 4d 41 43 48 49 4e 45 | 5f 4d 41 43 49 4e 54 4f |_MACHINE|_MACINTO|
|00003b90| 53 48 0d 09 09 48 50 61 | 72 61 6d 42 6c 6f 63 6b |SH...HPa|ramBlock|
|00003ba0| 52 65 63 09 68 50 61 72 | 61 6d 42 6c 6f 63 6b 3b |Rec.hPar|amBlock;|
|00003bb0| 0d 09 09 69 6e 74 20 09 | 09 09 09 09 09 69 6f 52 |...int .|.....ioR|
|00003bc0| 65 73 75 6c 74 3b 0d 09 | 09 53 74 72 32 35 35 09 |esult;..|.Str255.|
|00003bd0| 09 09 09 09 70 61 74 68 | 4e 61 6d 65 50 53 74 72 |....path|NamePStr|
|00003be0| 69 6e 67 3b 0d 09 09 69 | 6e 74 09 09 09 09 09 09 |ing;...i|nt......|
|00003bf0| 09 70 61 74 68 4c 65 6e | 67 74 68 3b 0d 09 23 65 |.pathLen|gth;..#e|
|00003c00| 6e 64 69 66 0d 0d 09 23 | 69 66 64 65 66 20 44 46 |ndif...#|ifdef DF|
|00003c10| 5f 4d 41 43 48 49 4e 45 | 5f 4d 41 43 49 4e 54 4f |_MACHINE|_MACINTO|
|00003c20| 53 48 0d 09 09 53 70 69 | 6e 43 75 72 73 6f 72 20 |SH...Spi|nCursor |
|00003c30| 28 31 29 3b 0d 09 09 62 | 7a 65 72 6f 20 28 26 68 |(1);...b|zero (&h|
|00003c40| 50 61 72 61 6d 42 6c 6f | 63 6b 2c 20 73 69 7a 65 |ParamBlo|ck, size|
|00003c50| 6f 66 20 28 48 50 61 72 | 61 6d 42 6c 6f 63 6b 52 |of (HPar|amBlockR|
|00003c60| 65 63 29 29 3b 0d 09 09 | 70 61 74 68 4c 65 6e 67 |ec));...|pathLeng|
|00003c70| 74 68 20 3d 20 73 74 72 | 6c 65 6e 20 28 70 61 74 |th = str|len (pat|
|00003c80| 68 43 68 61 72 50 74 72 | 29 3b 0d 09 09 69 66 20 |hCharPtr|);...if |
|00003c90| 28 70 61 74 68 4c 65 6e | 67 74 68 20 3e 20 46 49 |(pathLen|gth > FI|
|00003ca0| 4c 45 4e 41 4d 45 5f 4d | 41 58 29 0d 09 09 09 72 |LENAME_M|AX)....r|
|00003cb0| 65 74 75 72 6e 20 28 42 | 41 44 5f 46 49 4c 45 5f |eturn (B|AD_FILE_|
|00003cc0| 54 59 50 45 29 3b 0d 09 | 09 70 61 74 68 4e 61 6d |TYPE);..|.pathNam|
|00003cd0| 65 50 53 74 72 69 6e 67 | 20 5b 30 5d 20 3d 20 28 |ePString| [0] = (|
|00003ce0| 75 6e 73 69 67 6e 65 64 | 20 63 68 61 72 29 20 70 |unsigned| char) p|
|00003cf0| 61 74 68 4c 65 6e 67 74 | 68 3b 0d 09 09 6d 65 6d |athLengt|h;...mem|
|00003d00| 63 70 79 20 28 70 61 74 | 68 4e 61 6d 65 50 53 74 |cpy (pat|hNamePSt|
|00003d10| 72 69 6e 67 20 2b 20 31 | 2c 20 70 61 74 68 43 68 |ring + 1|, pathCh|
|00003d20| 61 72 50 74 72 2c 20 70 | 61 74 68 4c 65 6e 67 74 |arPtr, p|athLengt|
|00003d30| 68 29 3b 0d 09 09 68 50 | 61 72 61 6d 42 6c 6f 63 |h);...hP|aramBloc|
|00003d40| 6b 2e 66 69 6c 65 50 61 | 72 61 6d 2e 69 6f 4e 61 |k.filePa|ram.ioNa|
|00003d50| 6d 65 50 74 72 20 3d 20 | 70 61 74 68 4e 61 6d 65 |mePtr = |pathName|
|00003d60| 50 53 74 72 69 6e 67 3b | 0d 09 23 65 6e 64 69 66 |PString;|..#endif|
|00003d70| 0d 09 66 69 6c 65 4d 6f | 64 65 43 68 61 72 50 74 |..fileMo|deCharPt|
|00003d80| 72 20 3d 20 22 77 22 3b | 0d 09 69 66 20 28 62 69 |r = "w";|..if (bi|
|00003d90| 6e 61 72 79 29 0d 09 09 | 66 69 6c 65 4d 6f 64 65 |nary)...|fileMode|
|00003da0| 43 68 61 72 50 74 72 20 | 3d 20 22 77 62 22 3b 0d |CharPtr |= "wb";.|
|00003db0| 09 66 69 6c 65 50 74 72 | 20 3d 20 66 6f 70 65 6e |.filePtr| = fopen|
|00003dc0| 20 28 70 61 74 68 43 68 | 61 72 50 74 72 2c 20 66 | (pathCh|arPtr, f|
|00003dd0| 69 6c 65 4d 6f 64 65 43 | 68 61 72 50 74 72 29 3b |ileModeC|harPtr);|
|00003de0| 0d 09 69 66 20 28 66 69 | 6c 65 50 74 72 20 3d 3d |..if (fi|lePtr ==|
|00003df0| 20 4e 55 4c 4c 29 0d 09 | 09 45 72 72 6f 72 57 69 | NULL)..|.ErrorWi|
|00003e00| 74 68 53 74 72 69 6e 67 | 41 72 67 75 6d 65 6e 74 |thString|Argument|
|00003e10| 20 28 43 41 4e 54 5f 43 | 52 45 41 54 45 5f 46 49 | (CANT_C|REATE_FI|
|00003e20| 4c 45 2c 20 70 61 74 68 | 43 68 61 72 50 74 72 29 |LE, path|CharPtr)|
|00003e30| 3b 0d 09 23 69 66 64 65 | 66 20 44 46 5f 4d 41 43 |;..#ifde|f DF_MAC|
|00003e40| 48 49 4e 45 5f 4d 41 43 | 49 4e 54 4f 53 48 0d 09 |HINE_MAC|INTOSH..|
|00003e50| 09 69 6f 52 65 73 75 6c | 74 20 3d 20 50 42 48 47 |.ioResul|t = PBHG|
|00003e60| 65 74 46 49 6e 66 6f 53 | 79 6e 63 20 28 26 68 50 |etFInfoS|ync (&hP|
|00003e70| 61 72 61 6d 42 6c 6f 63 | 6b 29 3b 0d 09 09 69 66 |aramBloc|k);...if|
|00003e80| 20 28 69 6f 52 65 73 75 | 6c 74 20 21 3d 20 6e 6f | (ioResu|lt != no|
|00003e90| 45 72 72 29 0d 09 09 09 | 45 72 72 6f 72 57 69 74 |Err)....|ErrorWit|
|00003ea0| 68 53 74 72 69 6e 67 41 | 72 67 75 6d 65 6e 74 20 |hStringA|rgument |
|00003eb0| 28 55 4e 45 58 50 45 43 | 54 45 44 5f 49 4f 5f 45 |(UNEXPEC|TED_IO_E|
|00003ec0| 52 52 4f 52 2c 20 70 61 | 74 68 43 68 61 72 50 74 |RROR, pa|thCharPt|
|00003ed0| 72 29 3b 0d 09 09 68 50 | 61 72 61 6d 42 6c 6f 63 |r);...hP|aramBloc|
|00003ee0| 6b 2e 66 69 6c 65 50 61 | 72 61 6d 2e 69 6f 56 52 |k.filePa|ram.ioVR|
|00003ef0| 65 66 4e 75 6d 20 3d 20 | 30 3b 0d 09 09 68 50 61 |efNum = |0;...hPa|
|00003f00| 72 61 6d 42 6c 6f 63 6b | 2e 66 69 6c 65 50 61 72 |ramBlock|.filePar|
|00003f10| 61 6d 2e 69 6f 44 69 72 | 49 44 20 3d 20 30 3b 0d |am.ioDir|ID = 0;.|
|00003f20| 09 09 69 66 20 28 62 69 | 6e 61 72 79 29 20 7b 0d |..if (bi|nary) {.|
|00003f30| 09 09 09 68 50 61 72 61 | 6d 42 6c 6f 63 6b 2e 66 |...hPara|mBlock.f|
|00003f40| 69 6c 65 50 61 72 61 6d | 2e 69 6f 46 6c 46 6e 64 |ileParam|.ioFlFnd|
|00003f50| 72 49 6e 66 6f 2e 66 64 | 43 72 65 61 74 6f 72 20 |rInfo.fd|Creator |
|00003f60| 3d 20 28 4f 53 54 79 70 | 65 29 20 27 5c 3f 5c 3f |= (OSTyp|e) '\?\?|
|00003f70| 5c 3f 5c 3f 27 3b 0d 09 | 09 09 68 50 61 72 61 6d |\?\?';..|..hParam|
|00003f80| 42 6c 6f 63 6b 2e 66 69 | 6c 65 50 61 72 61 6d 2e |Block.fi|leParam.|
|00003f90| 69 6f 46 6c 46 6e 64 72 | 49 6e 66 6f 2e 66 64 54 |ioFlFndr|Info.fdT|
|00003fa0| 79 70 65 20 3d 20 28 4f | 53 54 79 70 65 29 20 27 |ype = (O|SType) '|
|00003fb0| 5c 3f 5c 3f 5c 3f 5c 3f | 27 3b 0d 09 09 7d 20 65 |\?\?\?\?|';...} e|
|00003fc0| 6c 73 65 20 2f 2a 20 41 | 53 43 49 49 20 2a 2f 0d |lse /* A|SCII */.|
|00003fd0| 09 09 09 68 50 61 72 61 | 6d 42 6c 6f 63 6b 2e 66 |...hPara|mBlock.f|
|00003fe0| 69 6c 65 50 61 72 61 6d | 2e 69 6f 46 6c 46 6e 64 |ileParam|.ioFlFnd|
|00003ff0| 72 49 6e 66 6f 2e 66 64 | 43 72 65 61 74 6f 72 20 |rInfo.fd|Creator |
|00004000| 3d 20 28 4f 53 54 79 70 | 65 29 20 27 4d 50 53 20 |= (OSTyp|e) 'MPS |
|00004010| 27 3b 0d 09 09 69 6f 52 | 65 73 75 6c 74 20 3d 20 |';...ioR|esult = |
|00004020| 50 42 48 53 65 74 46 49 | 6e 66 6f 53 79 6e 63 20 |PBHSetFI|nfoSync |
|00004030| 28 26 68 50 61 72 61 6d | 42 6c 6f 63 6b 29 3b 0d |(&hParam|Block);.|
|00004040| 09 09 69 66 20 28 69 6f | 52 65 73 75 6c 74 20 21 |..if (io|Result !|
|00004050| 3d 20 6e 6f 45 72 72 29 | 0d 09 09 09 45 72 72 6f |= noErr)|....Erro|
|00004060| 72 57 69 74 68 53 74 72 | 69 6e 67 41 72 67 75 6d |rWithStr|ingArgum|
|00004070| 65 6e 74 20 28 55 4e 45 | 58 50 45 43 54 45 44 5f |ent (UNE|XPECTED_|
|00004080| 49 4f 5f 45 52 52 4f 52 | 2c 20 70 61 74 68 43 68 |IO_ERROR|, pathCh|
|00004090| 61 72 50 74 72 29 3b 0d | 09 23 65 6e 64 69 66 0d |arPtr);.|.#endif.|
|000040a0| 09 72 65 74 75 72 6e 20 | 28 66 69 6c 65 50 74 72 |.return |(filePtr|
|000040b0| 29 3b 0d 7d 0d 0d 2f 2a | 0d 20 2a 20 41 20 6d 61 |);.}../*|. * A ma|
|000040c0| 63 68 69 6e 65 20 64 65 | 70 65 6e 64 65 6e 74 20 |chine de|pendent |
|000040d0| 72 6f 75 74 69 6e 65 20 | 74 68 61 74 20 74 65 73 |routine |that tes|
|000040e0| 74 73 20 61 20 70 61 74 | 68 20 61 6e 64 20 72 65 |ts a pat|h and re|
|000040f0| 74 75 72 6e 73 20 77 68 | 61 74 20 69 74 20 63 61 |turns wh|at it ca|
|00004100| 6e 20 66 69 67 75 72 65 | 20 6f 75 74 0d 20 2a 20 |n figure| out. * |
|00004110| 61 62 6f 75 74 20 77 68 | 61 74 20 74 79 70 65 20 |about wh|at type |
|00004120| 6f 66 20 66 69 6c 65 20 | 69 74 20 69 73 0d 20 2a |of file |it is. *|
|00004130| 2f 0d 0d 23 69 66 64 65 | 66 20 44 46 5f 4d 41 43 |/..#ifde|f DF_MAC|
|00004140| 48 49 4e 45 5f 4d 41 43 | 49 4e 54 4f 53 48 0d 09 |HINE_MAC|INTOSH..|
|00004150| 69 6e 74 0d 09 46 69 6c | 65 54 79 70 65 20 28 63 |int..Fil|eType (c|
|00004160| 6f 6e 73 74 20 63 68 61 | 72 20 2a 70 61 74 68 43 |onst cha|r *pathC|
|00004170| 68 61 72 50 74 72 29 0d | 09 7b 0d 09 09 4f 53 45 |harPtr).|.{...OSE|
|00004180| 72 72 09 09 09 09 69 6f | 52 65 73 75 6c 74 3b 0d |rr....io|Result;.|
|00004190| 09 09 43 49 6e 66 6f 50 | 42 52 65 63 09 70 61 72 |..CInfoP|BRec.par|
|000041a0| 61 6d 42 6c 6b 3b 0d 09 | 09 69 6e 74 09 09 09 09 |amBlk;..|.int....|
|000041b0| 09 70 61 74 68 4c 65 6e | 67 74 68 3b 0d 09 09 53 |.pathLen|gth;...S|
|000041c0| 74 72 32 35 35 09 09 09 | 70 61 74 68 4e 61 6d 65 |tr255...|pathName|
|000041d0| 50 53 74 72 69 6e 67 3b | 0d 09 0d 09 09 62 7a 65 |PString;|.....bze|
|000041e0| 72 6f 20 28 26 70 61 72 | 61 6d 42 6c 6b 2c 20 73 |ro (&par|amBlk, s|
|000041f0| 69 7a 65 6f 66 20 28 43 | 49 6e 66 6f 50 42 52 65 |izeof (C|InfoPBRe|
|00004200| 63 29 29 3b 0d 09 09 70 | 61 74 68 4c 65 6e 67 74 |c));...p|athLengt|
|00004210| 68 20 3d 20 73 74 72 6c | 65 6e 20 28 70 61 74 68 |h = strl|en (path|
|00004220| 43 68 61 72 50 74 72 29 | 3b 0d 09 09 69 66 20 28 |CharPtr)|;...if (|
|00004230| 70 61 74 68 4c 65 6e 67 | 74 68 20 3e 20 46 49 4c |pathLeng|th > FIL|
|00004240| 45 4e 41 4d 45 5f 4d 41 | 58 29 0d 09 09 09 72 65 |ENAME_MA|X)....re|
|00004250| 74 75 72 6e 20 28 42 41 | 44 5f 46 49 4c 45 5f 54 |turn (BA|D_FILE_T|
|00004260| 59 50 45 29 3b 0d 09 09 | 70 61 74 68 4e 61 6d 65 |YPE);...|pathName|
|00004270| 50 53 74 72 69 6e 67 20 | 5b 30 5d 20 3d 20 28 75 |PString |[0] = (u|
|00004280| 6e 73 69 67 6e 65 64 20 | 63 68 61 72 29 20 70 61 |nsigned |char) pa|
|00004290| 74 68 4c 65 6e 67 74 68 | 3b 0d 09 09 6d 65 6d 63 |thLength|;...memc|
|000042a0| 70 79 20 28 70 61 74 68 | 4e 61 6d 65 50 53 74 72 |py (path|NamePStr|
|000042b0| 69 6e 67 20 2b 20 31 2c | 20 70 61 74 68 43 68 61 |ing + 1,| pathCha|
|000042c0| 72 50 74 72 2c 20 70 61 | 74 68 4c 65 6e 67 74 68 |rPtr, pa|thLength|
|000042d0| 29 3b 0d 09 09 70 61 72 | 61 6d 42 6c 6b 2e 68 46 |);...par|amBlk.hF|
|000042e0| 69 6c 65 49 6e 66 6f 2e | 69 6f 4e 61 6d 65 50 74 |ileInfo.|ioNamePt|
|000042f0| 72 20 3d 20 70 61 74 68 | 4e 61 6d 65 50 53 74 72 |r = path|NamePStr|
|00004300| 69 6e 67 3b 0d 09 09 69 | 6f 52 65 73 75 6c 74 20 |ing;...i|oResult |
|00004310| 3d 20 50 42 47 65 74 43 | 61 74 49 6e 66 6f 53 79 |= PBGetC|atInfoSy|
|00004320| 6e 63 20 28 26 70 61 72 | 61 6d 42 6c 6b 29 3b 0d |nc (&par|amBlk);.|
|00004330| 09 09 69 66 20 28 69 6f | 52 65 73 75 6c 74 20 21 |..if (io|Result !|
|00004340| 3d 20 6e 6f 45 72 72 29 | 0d 09 09 09 72 65 74 75 |= noErr)|....retu|
|00004350| 72 6e 20 28 42 41 44 5f | 46 49 4c 45 5f 54 59 50 |rn (BAD_|FILE_TYP|
|00004360| 45 29 3b 0d 0d 09 20 20 | 69 66 20 28 28 70 61 72 |E);... |if ((par|
|00004370| 61 6d 42 6c 6b 2e 68 46 | 69 6c 65 49 6e 66 6f 2e |amBlk.hF|ileInfo.|
|00004380| 69 6f 46 6c 41 74 74 72 | 69 62 20 26 20 30 58 31 |ioFlAttr|ib & 0X1|
|00004390| 30 29 20 21 3d 20 30 29 | 0d 09 09 09 72 65 74 75 |0) != 0)|....retu|
|000043a0| 72 6e 20 28 44 49 52 45 | 43 54 4f 52 59 5f 54 59 |rn (DIRE|CTORY_TY|
|000043b0| 50 45 29 3b 0d 09 09 69 | 66 20 28 70 61 72 61 6d |PE);...i|f (param|
|000043c0| 42 6c 6b 2e 68 46 69 6c | 65 49 6e 66 6f 2e 69 6f |Blk.hFil|eInfo.io|
|000043d0| 46 6c 46 6e 64 72 49 6e | 66 6f 2e 66 64 54 79 70 |FlFndrIn|fo.fdTyp|
|000043e0| 65 20 3d 3d 20 28 4f 53 | 54 79 70 65 29 20 27 54 |e == (OS|Type) 'T|
|000043f0| 45 58 54 27 29 0d 09 09 | 09 72 65 74 75 72 6e 20 |EXT')...|.return |
|00004400| 28 54 45 58 54 5f 54 59 | 50 45 29 3b 0d 09 09 72 |(TEXT_TY|PE);...r|
|00004410| 65 74 75 72 6e 20 28 42 | 49 4e 41 52 59 5f 54 59 |eturn (B|INARY_TY|
|00004420| 50 45 29 3b 0d 09 7d 0d | 23 65 6e 64 69 66 0d 0d |PE);..}.|#endif..|
|00004430| 23 69 66 6e 64 65 66 20 | 44 46 5f 4d 41 43 48 49 |#ifndef |DF_MACHI|
|00004440| 4e 45 5f 4d 41 43 49 4e | 54 4f 53 48 0d 09 69 6e |NE_MACIN|TOSH..in|
|00004450| 74 0d 09 46 69 6c 65 54 | 79 70 65 20 28 63 6f 6e |t..FileT|ype (con|
|00004460| 73 74 20 63 68 61 72 20 | 2a 70 61 74 68 43 68 61 |st char |*pathCha|
|00004470| 72 50 74 72 29 0d 09 7b | 0d 09 09 23 69 66 64 65 |rPtr)..{|...#ifde|
|00004480| 66 20 44 46 5f 4d 41 43 | 48 49 4e 45 5f 57 49 4e |f DF_MAC|HINE_WIN|
|00004490| 44 4f 57 53 0d 09 09 7b | 0d 09 09 09 44 57 4f 52 |DOWS...{|....DWOR|
|000044a0| 44 09 09 09 09 09 09 66 | 69 6c 65 41 74 74 72 69 |D......f|ileAttri|
|000044b0| 62 75 74 65 73 3b 0d 0d | 09 09 09 66 69 6c 65 41 |butes;..|...fileA|
|000044c0| 74 74 72 69 62 75 74 65 | 73 20 3d 20 47 65 74 46 |ttribute|s = GetF|
|000044d0| 69 6c 65 41 74 74 72 69 | 62 75 74 65 73 20 28 70 |ileAttri|butes (p|
|000044e0| 61 74 68 43 68 61 72 50 | 74 72 29 3b 0d 09 09 09 |athCharP|tr);....|
|000044f0| 69 66 20 28 66 69 6c 65 | 41 74 74 72 69 62 75 74 |if (file|Attribut|
|00004500| 65 73 20 3d 3d 20 2d 31 | 29 0d 09 09 09 09 72 65 |es == -1|).....re|
|00004510| 74 75 72 6e 20 28 42 41 | 44 5f 46 49 4c 45 5f 54 |turn (BA|D_FILE_T|
|00004520| 59 50 45 29 3b 0d 09 09 | 09 69 66 20 28 66 69 6c |YPE);...|.if (fil|
|00004530| 65 41 74 74 72 69 62 75 | 74 65 73 20 26 20 46 49 |eAttribu|tes & FI|
|00004540| 4c 45 5f 41 54 54 52 49 | 42 55 54 45 5f 44 49 52 |LE_ATTRI|BUTE_DIR|
|00004550| 45 43 54 4f 52 59 29 0d | 09 09 09 09 72 65 74 75 |ECTORY).|....retu|
|00004560| 72 6e 20 28 44 49 52 45 | 43 54 4f 52 59 5f 54 59 |rn (DIRE|CTORY_TY|
|00004570| 50 45 29 3b 0d 09 09 7d | 0d 09 09 23 65 6c 69 66 |PE);...}|...#elif|
|00004580| 20 64 65 66 69 6e 65 64 | 20 28 44 46 5f 4d 41 43 | defined| (DF_MAC|
|00004590| 48 49 4e 45 5f 4e 45 58 | 54 29 0d 09 09 7b 0d 09 |HINE_NEX|T)...{..|
|000045a0| 09 09 69 6e 74 20 09 09 | 09 09 09 09 69 6f 52 65 |..int ..|....ioRe|
|000045b0| 73 75 6c 74 3b 0d 09 09 | 09 73 74 72 75 63 74 20 |sult;...|.struct |
|000045c0| 73 74 61 74 20 09 09 73 | 74 61 74 42 75 66 66 65 |stat ..s|tatBuffe|
|000045d0| 72 3b 0d 0d 09 09 09 69 | 6f 52 65 73 75 6c 74 20 |r;.....i|oResult |
|000045e0| 3d 20 73 74 61 74 28 70 | 61 74 68 43 68 61 72 50 |= stat(p|athCharP|
|000045f0| 74 72 2c 20 26 73 74 61 | 74 42 75 66 66 65 72 29 |tr, &sta|tBuffer)|
|00004600| 3b 0d 09 09 09 69 66 20 | 28 69 6f 52 65 73 75 6c |;....if |(ioResul|
|00004610| 74 20 21 3d 20 30 29 0d | 09 09 09 09 72 65 74 75 |t != 0).|....retu|
|00004620| 72 6e 20 28 42 41 44 5f | 46 49 4c 45 5f 54 59 50 |rn (BAD_|FILE_TYP|
|00004630| 45 29 3b 0d 09 09 09 69 | 66 20 28 28 73 74 61 74 |E);....i|f ((stat|
|00004640| 42 75 66 66 65 72 2e 73 | 74 5f 6d 6f 64 65 20 26 |Buffer.s|t_mode &|
|00004650| 20 53 5f 49 46 4d 54 29 | 20 3d 3d 20 53 5f 49 46 | S_IFMT)| == S_IF|
|00004660| 44 49 52 29 0d 09 09 09 | 09 72 65 74 75 72 6e 20 |DIR)....|.return |
|00004670| 28 44 49 52 45 43 54 4f | 52 59 5f 54 59 50 45 29 |(DIRECTO|RY_TYPE)|
|00004680| 3b 0d 09 09 7d 0d 09 09 | 23 65 6e 64 69 66 0d 09 |;...}...|#endif..|
|00004690| 09 69 66 20 28 50 61 74 | 68 48 61 73 45 78 74 65 |.if (Pat|hHasExte|
|000046a0| 6e 73 69 6f 6e 20 28 70 | 61 74 68 43 68 61 72 50 |nsion (p|athCharP|
|000046b0| 74 72 2c 20 62 69 6e 61 | 72 79 45 78 74 65 6e 73 |tr, bina|ryExtens|
|000046c0| 69 6f 6e 73 29 29 0d 09 | 09 09 72 65 74 75 72 6e |ions))..|..return|
|000046d0| 20 28 42 49 4e 41 52 59 | 5f 54 59 50 45 29 3b 0d | (BINARY|_TYPE);.|
|000046e0| 09 09 72 65 74 75 72 6e | 20 28 54 45 58 54 5f 54 |..return| (TEXT_T|
|000046f0| 59 50 45 29 3b 0d 09 7d | 0d 23 65 6e 64 69 66 0d |YPE);..}|.#endif.|
|00004700| 0d 2f 2a 20 53 70 6c 69 | 74 20 74 68 65 20 66 69 |./* Spli|t the fi|
|00004710| 6c 65 20 69 6e 74 6f 20 | 6c 69 6e 65 73 2c 20 73 |le into |lines, s|
|00004720| 69 6d 75 6c 74 61 6e 65 | 6f 75 73 6c 79 20 63 6f |imultane|ously co|
|00004730| 6d 70 75 74 69 6e 67 20 | 74 68 65 20 68 61 73 68 |mputing |the hash|
|00004740| 20 63 6f 64 65 73 20 66 | 6f 72 20 65 61 63 68 20 | codes f|or each |
|00004750| 6c 69 6e 65 2e 20 2a 2f | 0d 0d 76 6f 69 64 0d 66 |line. */|..void.f|
|00004760| 69 6e 64 5f 61 6e 64 5f | 68 61 73 68 5f 65 61 63 |ind_and_|hash_eac|
|00004770| 68 5f 6c 69 6e 65 20 28 | 72 65 67 69 73 74 65 72 |h_line (|register|
|00004780| 20 73 74 72 75 63 74 20 | 66 69 6c 65 5f 64 61 74 | struct |file_dat|
|00004790| 61 20 2a 66 69 6c 65 50 | 74 72 29 0d 7b 0d 09 75 |a *fileP|tr).{..u|
|000047a0| 6e 73 69 67 6e 65 64 20 | 63 68 61 72 20 09 09 09 |nsigned |char ...|
|000047b0| 09 63 3b 0d 09 63 68 61 | 72 09 09 09 09 09 09 09 |.c;..cha|r.......|
|000047c0| 09 20 2a 65 6e 64 43 68 | 61 72 50 74 72 3b 0d 09 |. *endCh|arPtr;..|
|000047d0| 75 6e 73 69 67 6e 65 64 | 09 09 09 09 09 09 09 68 |unsigned|.......h|
|000047e0| 3b 0d 09 75 6e 73 69 67 | 6e 65 64 20 63 68 61 72 |;..unsig|ned char|
|000047f0| 20 09 09 09 20 2a 69 70 | 3b 0d 09 75 6e 73 69 67 | ... *ip|;..unsig|
|00004800| 6e 65 64 20 63 68 61 72 | 20 09 09 09 20 2a 70 3b |ned char| ... *p;|
|00004810| 0d 0d 09 70 20 3d 20 28 | 75 6e 73 69 67 6e 65 64 |...p = (|unsigned|
|00004820| 20 63 68 61 72 20 2a 29 | 20 66 69 6c 65 50 74 72 | char *)| filePtr|
|00004830| 2d 3e 62 75 66 66 65 72 | 3b 0d 0d 09 69 66 20 28 |->buffer|;...if (|
|00004840| 66 69 6c 65 50 74 72 2d | 3e 62 75 66 66 65 72 20 |filePtr-|>buffer |
|00004850| 21 3d 20 4e 55 4c 4c 29 | 20 7b 0d 09 09 2f 2a 20 |!= NULL)| {.../* |
|00004860| 41 74 74 65 6d 70 74 20 | 74 6f 20 67 65 74 20 61 |Attempt |to get a|
|00004870| 20 67 6f 6f 64 20 69 6e | 69 74 69 61 6c 20 67 75 | good in|itial gu|
|00004880| 65 73 73 20 61 73 20 74 | 6f 20 74 68 65 20 6e 75 |ess as t|o the nu|
|00004890| 6d 62 65 72 20 6f 66 20 | 6c 69 6e 65 73 2e 20 2a |mber of |lines. *|
|000048a0| 2f 0d 09 09 69 66 20 28 | 66 69 6c 65 50 74 72 2d |/...if (|filePtr-|
|000048b0| 3e 6c 69 6e 62 75 66 20 | 3d 3d 20 4e 55 4c 4c 29 |>linbuf |== NULL)|
|000048c0| 20 7b 0d 09 09 09 66 69 | 6c 65 50 74 72 2d 3e 6c | {....fi|lePtr->l|
|000048d0| 69 6e 62 75 66 73 69 7a | 65 20 3d 20 66 69 6c 65 |inbufsiz|e = file|
|000048e0| 50 74 72 2d 3e 62 75 66 | 66 65 72 65 64 5f 63 68 |Ptr->buf|fered_ch|
|000048f0| 61 72 73 20 2f 20 35 30 | 20 2b 20 35 3b 0d 09 09 |ars / 50| + 5;...|
|00004900| 09 66 69 6c 65 50 74 72 | 2d 3e 6c 69 6e 62 75 66 |.filePtr|->linbuf|
|00004910| 20 3d 20 28 73 74 72 75 | 63 74 20 6c 69 6e 65 5f | = (stru|ct line_|
|00004920| 64 65 66 20 2a 29 20 78 | 6d 61 6c 6c 6f 63 20 28 |def *) x|malloc (|
|00004930| 66 69 6c 65 50 74 72 2d | 3e 6c 69 6e 62 75 66 73 |filePtr-|>linbufs|
|00004940| 69 7a 65 20 2a 20 73 69 | 7a 65 6f 66 20 28 73 74 |ize * si|zeof (st|
|00004950| 72 75 63 74 20 6c 69 6e | 65 5f 64 65 66 29 29 3b |ruct lin|e_def));|
|00004960| 0d 09 09 7d 0d 0d 09 09 | 66 69 6c 65 50 74 72 2d |...}....|filePtr-|
|00004970| 3e 62 75 66 66 65 72 65 | 64 5f 6c 69 6e 65 73 20 |>buffere|d_lines |
|00004980| 3d 20 30 3b 0d 09 09 65 | 6e 64 43 68 61 72 50 74 |= 0;...e|ndCharPt|
|00004990| 72 20 3d 20 66 69 6c 65 | 50 74 72 2d 3e 62 75 66 |r = file|Ptr->buf|
|000049a0| 66 65 72 20 2b 20 66 69 | 6c 65 50 74 72 2d 3e 62 |fer + fi|lePtr->b|
|000049b0| 75 66 66 65 72 65 64 5f | 63 68 61 72 73 3b 0d 0d |uffered_|chars;..|
|000049c0| 09 09 77 68 69 6c 65 20 | 28 28 63 68 61 72 20 2a |..while |((char *|
|000049d0| 29 20 70 20 3c 20 65 6e | 64 43 68 61 72 50 74 72 |) p < en|dCharPtr|
|000049e0| 29 0d 09 09 09 7b 0d 09 | 09 09 09 68 20 3d 20 30 |)....{..|...h = 0|
|000049f0| 3b 0d 09 09 09 09 69 70 | 20 3d 20 70 3b 0d 0d 09 |;.....ip| = p;...|
|00004a00| 09 09 09 69 66 20 28 66 | 69 6c 65 50 74 72 2d 3e |...if (f|ilePtr->|
|00004a10| 70 72 65 66 69 78 5f 65 | 6e 64 20 3c 3d 20 28 63 |prefix_e|nd <= (c|
|00004a20| 68 61 72 20 2a 29 20 70 | 20 26 26 20 66 69 6c 65 |har *) p| && file|
|00004a30| 50 74 72 2d 3e 73 75 66 | 66 69 78 5f 62 65 67 69 |Ptr->suf|fix_begi|
|00004a40| 6e 20 3e 3d 20 28 63 68 | 61 72 20 2a 29 20 70 29 |n >= (ch|ar *) p)|
|00004a50| 0d 09 09 09 09 09 7b 0d | 09 09 09 09 09 09 2f 2a |......{.|....../*|
|00004a60| 20 48 61 73 68 20 74 68 | 69 73 20 6c 69 6e 65 20 | Hash th|is line |
|00004a70| 75 6e 74 69 6c 20 77 65 | 20 66 69 6e 64 20 61 20 |until we| find a |
|00004a80| 6e 65 77 6c 69 6e 65 2e | 20 2a 2f 0d 09 09 09 09 |newline.| */.....|
|00004a90| 09 09 77 68 69 6c 65 20 | 28 28 63 20 3d 20 2a 70 |..while |((c = *p|
|00004aa0| 29 20 21 3d 20 27 5c 6e | 27 29 0d 09 09 09 09 09 |) != '\n|')......|
|00004ab0| 09 09 7b 0d 09 09 09 09 | 09 09 09 09 68 20 3d 20 |..{.....|....h = |
|00004ac0| 48 41 53 48 20 28 68 2c | 20 63 29 3b 0d 09 09 09 |HASH (h,| c);....|
|00004ad0| 09 09 09 09 09 2b 2b 70 | 3b 0d 09 09 09 09 09 09 |.....++p|;.......|
|00004ae0| 09 7d 0d 09 09 09 09 09 | 7d 0d 09 09 09 09 65 6c |.}......|}.....el|
|00004af0| 73 65 0d 09 09 09 09 09 | 2f 2a 20 54 68 69 73 20 |se......|/* This |
|00004b00| 6c 69 6e 65 20 69 73 20 | 70 61 72 74 20 6f 66 20 |line is |part of |
|00004b10| 74 68 65 20 6d 61 74 63 | 68 69 6e 67 20 70 72 65 |the matc|hing pre|
|00004b20| 66 69 78 2c 0d 09 09 09 | 09 09 09 20 73 6f 20 77 |fix,....|... so w|
|00004b30| 65 20 64 6f 6e 27 74 20 | 6e 65 65 64 20 74 6f 20 |e don't |need to |
|00004b40| 68 61 73 68 20 69 74 2e | 20 20 2a 2f 0d 09 09 09 |hash it.| */....|
|00004b50| 09 09 77 68 69 6c 65 20 | 28 2a 70 20 21 3d 20 27 |..while |(*p != '|
|00004b60| 5c 6e 27 29 0d 09 09 09 | 09 09 09 2b 2b 70 3b 0d |\n')....|...++p;.|
|00004b70| 0d 09 09 09 09 2f 2a 20 | 4d 61 79 62 65 20 69 6e |...../* |Maybe in|
|00004b80| 63 72 65 61 73 65 20 74 | 68 65 20 73 69 7a 65 20 |crease t|he size |
|00004b90| 6f 66 20 74 68 65 20 6c | 69 6e 65 20 74 61 62 6c |of the l|ine tabl|
|00004ba0| 65 2e 20 2a 2f 0d 09 09 | 09 09 69 66 20 28 66 69 |e. */...|..if (fi|
|00004bb0| 6c 65 50 74 72 2d 3e 62 | 75 66 66 65 72 65 64 5f |lePtr->b|uffered_|
|00004bc0| 6c 69 6e 65 73 20 3e 3d | 20 66 69 6c 65 50 74 72 |lines >=| filePtr|
|00004bd0| 2d 3e 6c 69 6e 62 75 66 | 73 69 7a 65 29 0d 09 09 |->linbuf|size)...|
|00004be0| 09 09 09 7b 0d 09 09 09 | 09 09 09 77 68 69 6c 65 |...{....|...while|
|00004bf0| 20 28 66 69 6c 65 50 74 | 72 2d 3e 62 75 66 66 65 | (filePt|r->buffe|
|00004c00| 72 65 64 5f 6c 69 6e 65 | 73 20 3e 3d 20 66 69 6c |red_line|s >= fil|
|00004c10| 65 50 74 72 2d 3e 6c 69 | 6e 62 75 66 73 69 7a 65 |ePtr->li|nbufsize|
|00004c20| 29 0d 09 09 09 09 09 09 | 09 66 69 6c 65 50 74 72 |).......|.filePtr|
|00004c30| 2d 3e 6c 69 6e 62 75 66 | 73 69 7a 65 20 2a 3d 20 |->linbuf|size *= |
|00004c40| 32 3b 0d 09 09 09 09 09 | 09 66 69 6c 65 50 74 72 |2;......|.filePtr|
|00004c50| 2d 3e 6c 69 6e 62 75 66 | 20 3d 20 28 73 74 72 75 |->linbuf| = (stru|
|00004c60| 63 74 20 6c 69 6e 65 5f | 64 65 66 20 2a 29 20 78 |ct line_|def *) x|
|00004c70| 72 65 61 6c 6c 6f 63 20 | 28 66 69 6c 65 50 74 72 |realloc |(filePtr|
|00004c80| 2d 3e 6c 69 6e 62 75 66 | 2c 0d 09 09 09 09 09 09 |->linbuf|,.......|
|00004c90| 09 09 09 09 09 09 09 09 | 09 09 09 09 09 09 09 09 |........|........|
|00004ca0| 09 09 09 09 09 09 09 09 | 66 69 6c 65 50 74 72 2d |........|filePtr-|
|00004cb0| 3e 6c 69 6e 62 75 66 73 | 69 7a 65 20 2a 20 73 69 |>linbufs|ize * si|
|00004cc0| 7a 65 6f 66 20 28 73 74 | 72 75 63 74 20 6c 69 6e |zeof (st|ruct lin|
|00004cd0| 65 5f 64 65 66 29 29 3b | 0d 09 09 09 09 09 7d 0d |e_def));|......}.|
|00004ce0| 09 09 09 09 66 69 6c 65 | 50 74 72 2d 3e 6c 69 6e |....file|Ptr->lin|
|00004cf0| 62 75 66 5b 66 69 6c 65 | 50 74 72 2d 3e 62 75 66 |buf[file|Ptr->buf|
|00004d00| 66 65 72 65 64 5f 6c 69 | 6e 65 73 5d 2e 74 65 78 |fered_li|nes].tex|
|00004d10| 74 20 3d 20 28 63 68 61 | 72 20 2a 29 20 69 70 3b |t = (cha|r *) ip;|
|00004d20| 0d 09 09 09 09 66 69 6c | 65 50 74 72 2d 3e 6c 69 |.....fil|ePtr->li|
|00004d30| 6e 62 75 66 5b 66 69 6c | 65 50 74 72 2d 3e 62 75 |nbuf[fil|ePtr->bu|
|00004d40| 66 66 65 72 65 64 5f 6c | 69 6e 65 73 5d 2e 6c 65 |ffered_l|ines].le|
|00004d50| 6e 67 74 68 20 3d 20 70 | 20 2d 20 69 70 20 2b 20 |ngth = p| - ip + |
|00004d60| 31 3b 0d 09 09 09 09 66 | 69 6c 65 50 74 72 2d 3e |1;.....f|ilePtr->|
|00004d70| 6c 69 6e 62 75 66 5b 66 | 69 6c 65 50 74 72 2d 3e |linbuf[f|ilePtr->|
|00004d80| 62 75 66 66 65 72 65 64 | 5f 6c 69 6e 65 73 5d 2e |buffered|_lines].|
|00004d90| 68 61 73 68 20 3d 20 68 | 3b 0d 09 09 09 09 2b 2b |hash = h|;.....++|
|00004da0| 66 69 6c 65 50 74 72 2d | 3e 62 75 66 66 65 72 65 |filePtr-|>buffere|
|00004db0| 64 5f 6c 69 6e 65 73 3b | 0d 09 09 09 09 2b 2b 70 |d_lines;|.....++p|
|00004dc0| 3b 0d 09 09 09 7d 0d 0d | 09 09 66 69 6c 65 50 74 |;....}..|..filePt|
|00004dd0| 72 2d 3e 6c 69 6e 62 75 | 66 73 69 7a 65 20 3d 20 |r->linbu|fsize = |
|00004de0| 66 69 6c 65 50 74 72 2d | 3e 62 75 66 66 65 72 65 |filePtr-|>buffere|
|00004df0| 64 5f 6c 69 6e 65 73 3b | 0d 09 09 66 69 6c 65 50 |d_lines;|...fileP|
|00004e00| 74 72 2d 3e 6c 69 6e 62 | 75 66 20 3d 20 28 73 74 |tr->linb|uf = (st|
|00004e10| 72 75 63 74 20 6c 69 6e | 65 5f 64 65 66 20 2a 29 |ruct lin|e_def *)|
|00004e20| 20 78 72 65 61 6c 6c 6f | 63 20 28 66 69 6c 65 50 | xreallo|c (fileP|
|00004e30| 74 72 2d 3e 6c 69 6e 62 | 75 66 2c 0d 09 09 09 09 |tr->linb|uf,.....|
|00004e40| 09 09 09 09 09 09 09 09 | 09 09 09 09 09 09 09 09 |........|........|
|00004e50| 09 09 09 09 09 09 66 69 | 6c 65 50 74 72 2d 3e 6c |......fi|lePtr->l|
|00004e60| 69 6e 62 75 66 73 69 7a | 65 20 2a 20 73 69 7a 65 |inbufsiz|e * size|
|00004e70| 6f 66 20 28 73 74 72 75 | 63 74 20 6c 69 6e 65 5f |of (stru|ct line_|
|00004e80| 64 65 66 29 29 3b 0d 0d | 2f 2a 0d 09 09 54 68 65 |def));..|/*...The|
|00004e90| 20 66 6f 6c 6c 6f 77 69 | 6e 67 20 69 66 20 73 74 | followi|ng if st|
|00004ea0| 61 74 65 6d 65 6e 74 20 | 66 72 6f 6d 20 74 68 65 |atement |from the|
|00004eb0| 20 47 4e 55 20 73 6f 75 | 72 63 65 73 20 64 6f 65 | GNU sou|rces doe|
|00004ec0| 73 6e 27 74 20 77 6f 72 | 6b 20 77 68 65 6e 20 6d |sn't wor|k when m|
|00004ed0| 65 72 67 69 6e 67 20 66 | 69 6c 65 73 20 74 68 61 |erging f|iles tha|
|00004ee0| 74 0d 09 09 64 6f 6e 27 | 74 20 65 6e 64 20 69 6e |t...don'|t end in|
|00004ef0| 20 61 20 72 65 74 75 72 | 6e 20 61 6e 64 20 6e 6f | a retur|n and no|
|00004f00| 20 63 68 61 6e 67 65 73 | 20 61 72 65 20 64 65 74 | changes| are det|
|00004f10| 65 63 74 65 64 2e 20 20 | 49 27 76 65 20 6d 6f 64 |ected. |I've mod|
|00004f20| 69 66 69 65 64 20 74 68 | 65 20 69 66 20 61 73 20 |ified th|e if as |
|00004f30| 73 68 6f 77 6e 20 62 65 | 6c 6f 77 0d 09 09 61 6e |shown be|low...an|
|00004f40| 64 20 49 27 6d 20 6e 6f | 74 20 31 30 30 25 20 73 |d I'm no|t 100% s|
|00004f50| 75 72 65 20 74 68 61 74 | 20 74 68 69 73 20 63 68 |ure that| this ch|
|00004f60| 61 6e 67 65 20 77 6f 6e | 27 74 20 69 6e 74 72 6f |ange won|'t intro|
|00004f70| 64 75 63 65 20 62 75 67 | 73 2c 20 68 6f 77 65 76 |duce bug|s, howev|
|00004f80| 65 72 20 69 74 20 64 6f | 65 73 20 70 61 73 73 20 |er it do|es pass |
|00004f90| 6d 79 0d 09 09 74 65 73 | 74 20 73 75 69 74 65 2e |my...tes|t suite.|
|00004fa0| 20 2d 2d 20 44 4a 41 0d | 0d 09 09 69 66 20 28 66 | -- DJA.|...if (f|
|00004fb0| 69 6c 65 50 74 72 2d 3e | 6d 69 73 73 69 6e 67 5f |ilePtr->|missing_|
|00004fc0| 6e 65 77 6c 69 6e 65 20 | 26 26 20 66 69 6c 65 50 |newline |&& fileP|
|00004fd0| 74 72 2d 3e 73 75 66 66 | 69 78 5f 62 65 67 69 6e |tr->suff|ix_begin|
|00004fe0| 20 3d 3d 20 65 6e 64 43 | 68 61 72 50 74 72 29 0d | == endC|harPtr).|
|00004ff0| 2a 2f 0d 0d 09 09 69 66 | 20 28 66 69 6c 65 50 74 |*/....if| (filePt|
|00005000| 72 2d 3e 6d 69 73 73 69 | 6e 67 5f 6e 65 77 6c 69 |r->missi|ng_newli|
|00005010| 6e 65 20 26 26 20 20 66 | 69 6c 65 50 74 72 2d 3e |ne && f|ilePtr->|
|00005020| 62 75 66 66 65 72 5b 66 | 69 6c 65 50 74 72 2d 3e |buffer[f|ilePtr->|
|00005030| 62 75 66 66 65 72 65 64 | 5f 63 68 61 72 73 2d 31 |buffered|_chars-1|
|00005040| 5d 20 3d 3d 20 27 5c 6e | 27 29 0d 09 09 09 2d 2d |] == '\n|')....--|
|00005050| 66 69 6c 65 50 74 72 2d | 3e 6c 69 6e 62 75 66 5b |filePtr-|>linbuf[|
|00005060| 66 69 6c 65 50 74 72 2d | 3e 62 75 66 66 65 72 65 |filePtr-|>buffere|
|00005070| 64 5f 6c 69 6e 65 73 20 | 2d 20 31 5d 2e 6c 65 6e |d_lines |- 1].len|
|00005080| 67 74 68 3b 0d 09 7d 0d | 7d 0d 0d 2f 2a 20 46 69 |gth;..}.|}../* Fi|
|00005090| 6e 64 20 74 68 65 20 65 | 71 75 69 76 20 63 6c 61 |nd the e|quiv cla|
|000050a0| 73 73 20 61 73 73 6f 63 | 69 61 74 65 64 20 77 69 |ss assoc|iated wi|
|000050b0| 74 68 20 61 6c 6c 20 6c | 69 6e 65 73 20 69 6e 20 |th all l|ines in |
|000050c0| 66 69 6c 65 50 74 72 2e | 20 20 2a 2f 0d 0d 76 6f |filePtr.| */..vo|
|000050d0| 69 64 0d 66 69 6e 64 5f | 65 71 75 69 76 5f 63 6c |id.find_|equiv_cl|
|000050e0| 61 73 73 20 28 72 65 67 | 69 73 74 65 72 20 73 74 |ass (reg|ister st|
|000050f0| 72 75 63 74 20 66 69 6c | 65 5f 64 61 74 61 20 2a |ruct fil|e_data *|
|00005100| 66 69 6c 65 50 74 72 29 | 0d 7b 0d 09 73 74 72 75 |filePtr)|.{..stru|
|00005110| 63 74 20 65 71 75 69 76 | 63 6c 61 73 73 20 09 20 |ct equiv|class . |
|00005120| 2a 62 3b 0d 09 69 6e 74 | 20 09 09 09 09 09 09 09 |*b;..int| .......|
|00005130| 09 09 62 75 63 6b 65 74 | 3b 0d 09 69 6e 74 20 09 |..bucket|;..int .|
|00005140| 09 09 09 09 09 09 09 09 | 65 71 75 69 76 73 56 61 |........|equivsVa|
|00005150| 6c 75 65 3b 0d 09 75 6e | 73 69 67 6e 65 64 20 69 |lue;..un|signed i|
|00005160| 6e 74 20 09 09 09 09 09 | 6c 69 6e 65 49 6e 64 65 |nt .....|lineInde|
|00005170| 78 3b 0d 09 73 74 72 75 | 63 74 20 65 71 75 69 76 |x;..stru|ct equiv|
|00005180| 63 6c 61 73 73 20 09 20 | 2a 70 3b 0d 0d 09 69 66 |class . |*p;...if|
|00005190| 20 28 66 69 6c 65 50 74 | 72 2d 3e 65 71 75 69 76 | (filePt|r->equiv|
|000051a0| 73 20 3d 3d 20 4e 55 4c | 4c 29 0d 09 09 66 69 6c |s == NUL|L)...fil|
|000051b0| 65 50 74 72 2d 3e 65 71 | 75 69 76 73 20 3d 20 28 |ePtr->eq|uivs = (|
|000051c0| 69 6e 74 20 2a 29 20 78 | 6d 61 6c 6c 6f 63 20 28 |int *) x|malloc (|
|000051d0| 66 69 6c 65 50 74 72 2d | 3e 62 75 66 66 65 72 65 |filePtr-|>buffere|
|000051e0| 64 5f 6c 69 6e 65 73 20 | 2a 20 73 69 7a 65 6f 66 |d_lines |* sizeof|
|000051f0| 20 28 69 6e 74 29 29 3b | 0d 0d 09 66 6f 72 20 28 | (int));|...for (|
|00005200| 6c 69 6e 65 49 6e 64 65 | 78 20 3d 20 30 3b 20 6c |lineInde|x = 0; l|
|00005210| 69 6e 65 49 6e 64 65 78 | 20 3c 20 66 69 6c 65 50 |ineIndex| < fileP|
|00005220| 74 72 2d 3e 62 75 66 66 | 65 72 65 64 5f 6c 69 6e |tr->buff|ered_lin|
|00005230| 65 73 3b 20 2b 2b 6c 69 | 6e 65 49 6e 64 65 78 29 |es; ++li|neIndex)|
|00005240| 0d 09 09 7b 0d 09 09 09 | 70 20 3d 20 4e 55 4c 4c |...{....|p = NULL|
|00005250| 3b 0d 09 09 09 2f 2a 20 | 45 71 75 69 76 61 6c 65 |;..../* |Equivale|
|00005260| 6e 63 65 20 63 6c 61 73 | 73 20 30 20 69 73 20 70 |nce clas|s 0 is p|
|00005270| 65 72 6d 61 6e 65 6e 74 | 6c 79 20 61 6c 6c 6f 63 |ermanent|ly alloc|
|00005280| 61 74 65 64 20 74 6f 20 | 6c 69 6e 65 73 20 74 68 |ated to |lines th|
|00005290| 61 74 20 77 65 72 65 0d | 09 09 09 09 20 6e 6f 74 |at were.|.... not|
|000052a0| 20 68 61 73 68 65 64 20 | 62 65 63 61 75 73 65 20 | hashed |because |
|000052b0| 74 68 65 79 20 77 65 72 | 65 20 70 61 72 74 73 20 |they wer|e parts |
|000052c0| 6f 66 20 69 64 65 6e 74 | 69 63 61 6c 20 70 72 65 |of ident|ical pre|
|000052d0| 66 69 78 65 73 20 6f 72 | 0d 09 09 09 09 20 73 75 |fixes or|..... su|
|000052e0| 66 66 69 78 65 73 2e 20 | 2a 2f 0d 09 09 09 69 66 |ffixes. |*/....if|
|000052f0| 20 28 6c 69 6e 65 49 6e | 64 65 78 20 3c 20 66 69 | (lineIn|dex < fi|
|00005300| 6c 65 50 74 72 2d 3e 70 | 72 65 66 69 78 5f 6c 69 |lePtr->p|refix_li|
|00005310| 6e 65 73 20 7c 7c 20 66 | 69 6c 65 50 74 72 2d 3e |nes || f|ilePtr->|
|00005320| 6c 69 6e 62 75 66 5b 6c | 69 6e 65 49 6e 64 65 78 |linbuf[l|ineIndex|
|00005330| 5d 2e 74 65 78 74 20 3e | 3d 20 66 69 6c 65 50 74 |].text >|= filePt|
|00005340| 72 2d 3e 73 75 66 66 69 | 78 5f 62 65 67 69 6e 29 |r->suffi|x_begin)|
|00005350| 0d 09 09 09 09 7b 0d 09 | 09 09 09 09 65 71 75 69 |.....{..|....equi|
|00005360| 76 73 56 61 6c 75 65 20 | 3d 20 30 3b 0d 09 09 09 |vsValue |= 0;....|
|00005370| 09 09 67 6f 74 6f 20 53 | 65 74 45 71 75 69 76 73 |..goto S|etEquivs|
|00005380| 56 61 6c 75 65 3b 0d 09 | 09 09 09 7d 0d 0d 09 09 |Value;..|...}....|
|00005390| 09 2f 2a 20 43 68 65 63 | 6b 20 74 68 72 6f 75 67 |./* Chec|k throug|
|000053a0| 68 20 74 68 65 20 61 70 | 70 72 6f 70 72 69 61 74 |h the ap|propriat|
|000053b0| 65 20 62 75 63 6b 65 74 | 20 74 6f 20 73 65 65 20 |e bucket| to see |
|000053c0| 69 66 20 74 68 65 72 65 | 20 69 73 6e 27 74 20 61 |if there| isn't a|
|000053d0| 6c 72 65 61 64 79 0d 09 | 09 09 09 20 61 6e 20 65 |lready..|... an e|
|000053e0| 71 75 69 76 61 6c 65 6e | 63 65 20 63 6c 61 73 73 |quivalen|ce class|
|000053f0| 20 66 6f 72 20 74 68 69 | 73 20 6c 69 6e 65 2e 20 | for thi|s line. |
|00005400| 2a 2f 0d 09 09 09 62 75 | 63 6b 65 74 20 3d 20 66 |*/....bu|cket = f|
|00005410| 69 6c 65 50 74 72 2d 3e | 6c 69 6e 62 75 66 5b 6c |ilePtr->|linbuf[l|
|00005420| 69 6e 65 49 6e 64 65 78 | 5d 2e 68 61 73 68 20 25 |ineIndex|].hash %|
|00005430| 20 6e 62 75 63 6b 65 74 | 73 3b 0d 09 09 09 62 20 | nbucket|s;....b |
|00005440| 3d 20 62 75 63 6b 65 74 | 73 5b 62 75 63 6b 65 74 |= bucket|s[bucket|
|00005450| 5d 3b 0d 09 09 09 77 68 | 69 6c 65 20 28 62 29 0d |];....wh|ile (b).|
|00005460| 09 09 09 09 7b 0d 09 09 | 09 09 09 69 66 20 28 62 |....{...|...if (b|
|00005470| 2d 3e 6c 69 6e 65 2e 68 | 61 73 68 20 3d 3d 20 66 |->line.h|ash == f|
|00005480| 69 6c 65 50 74 72 2d 3e | 6c 69 6e 62 75 66 5b 6c |ilePtr->|linbuf[l|
|00005490| 69 6e 65 49 6e 64 65 78 | 5d 2e 68 61 73 68 20 26 |ineIndex|].hash &|
|000054a0| 26 0d 09 09 09 09 09 09 | 09 62 2d 3e 6c 69 6e 65 |&.......|.b->line|
|000054b0| 2e 6c 65 6e 67 74 68 20 | 3d 3d 20 66 69 6c 65 50 |.length |== fileP|
|000054c0| 74 72 2d 3e 6c 69 6e 62 | 75 66 5b 6c 69 6e 65 49 |tr->linb|uf[lineI|
|000054d0| 6e 64 65 78 5d 2e 6c 65 | 6e 67 74 68 20 26 26 0d |ndex].le|ngth &&.|
|000054e0| 09 09 09 09 09 09 09 21 | 6c 69 6e 65 5f 63 6d 70 |.......!|line_cmp|
|000054f0| 20 28 26 62 2d 3e 6c 69 | 6e 65 2c 20 26 66 69 6c | (&b->li|ne, &fil|
|00005500| 65 50 74 72 2d 3e 6c 69 | 6e 62 75 66 5b 6c 69 6e |ePtr->li|nbuf[lin|
|00005510| 65 49 6e 64 65 78 5d 29 | 29 0d 09 09 09 09 09 09 |eIndex])|).......|
|00005520| 7b 0d 09 09 09 09 09 09 | 09 65 71 75 69 76 73 56 |{.......|.equivsV|
|00005530| 61 6c 75 65 20 3d 20 62 | 20 2d 20 65 71 75 69 76 |alue = b| - equiv|
|00005540| 73 3b 0d 09 09 09 09 09 | 09 09 67 6f 74 6f 20 53 |s;......|..goto S|
|00005550| 65 74 45 71 75 69 76 73 | 56 61 6c 75 65 3b 0d 09 |etEquivs|Value;..|
|00005560| 09 09 09 09 09 7d 0d 09 | 09 09 09 09 70 20 3d 20 |.....}..|....p = |
|00005570| 62 2c 20 62 20 3d 20 62 | 2d 3e 6e 65 78 74 3b 0d |b, b = b|->next;.|
|00005580| 09 09 09 09 7d 0d 0d 09 | 09 09 2f 2a 20 43 72 65 |....}...|../* Cre|
|00005590| 61 74 65 20 61 20 6e 65 | 77 20 65 71 75 69 76 61 |ate a ne|w equiva|
|000055a0| 6c 65 6e 63 65 20 63 6c | 61 73 73 20 69 6e 20 74 |lence cl|ass in t|
|000055b0| 68 69 73 20 62 75 63 6b | 65 74 2e 20 2a 2f 0d 0d |his buck|et. */..|
|000055c0| 09 09 09 70 20 3d 20 26 | 65 71 75 69 76 73 5b 65 |...p = &|equivs[e|
|000055d0| 71 75 69 76 73 5f 69 6e | 64 65 78 2b 2b 5d 3b 0d |quivs_in|dex++];.|
|000055e0| 09 09 09 70 2d 3e 6e 65 | 78 74 20 3d 20 62 75 63 |...p->ne|xt = buc|
|000055f0| 6b 65 74 73 5b 62 75 63 | 6b 65 74 5d 3b 0d 09 09 |kets[buc|ket];...|
|00005600| 09 62 75 63 6b 65 74 73 | 5b 62 75 63 6b 65 74 5d |.buckets|[bucket]|
|00005610| 20 3d 20 70 3b 0d 09 09 | 09 70 2d 3e 6c 69 6e 65 | = p;...|.p->line|
|00005620| 20 3d 20 66 69 6c 65 50 | 74 72 2d 3e 6c 69 6e 62 | = fileP|tr->linb|
|00005630| 75 66 5b 6c 69 6e 65 49 | 6e 64 65 78 5d 3b 0d 09 |uf[lineI|ndex];..|
|00005640| 09 09 65 71 75 69 76 73 | 56 61 6c 75 65 20 3d 20 |..equivs|Value = |
|00005650| 65 71 75 69 76 73 5f 69 | 6e 64 65 78 20 2d 20 31 |equivs_i|ndex - 1|
|00005660| 3b 0d 0d 53 65 74 45 71 | 75 69 76 73 56 61 6c 75 |;..SetEq|uivsValu|
|00005670| 65 3a 0d 09 09 09 66 69 | 6c 65 50 74 72 2d 3e 65 |e:....fi|lePtr->e|
|00005680| 71 75 69 76 73 5b 6c 69 | 6e 65 49 6e 64 65 78 5d |quivs[li|neIndex]|
|00005690| 20 3d 20 65 71 75 69 76 | 73 56 61 6c 75 65 3b 0d | = equiv|sValue;.|
|000056a0| 0d 09 09 7d 0d 7d 0d 0d | 2f 2a 20 47 69 76 65 6e |...}.}..|/* Given|
|000056b0| 20 61 20 76 65 63 74 6f | 72 20 6f 66 20 74 77 6f | a vecto|r of two|
|000056c0| 20 66 69 6c 65 5f 64 61 | 74 61 20 6f 62 6a 65 63 | file_da|ta objec|
|000056d0| 74 73 2c 20 66 69 6e 64 | 20 74 68 65 20 69 64 65 |ts, find| the ide|
|000056e0| 6e 74 69 63 61 6c 20 70 | 72 65 66 69 78 65 73 20 |ntical p|refixes |
|000056f0| 61 6e 64 20 73 75 66 66 | 69 78 65 73 20 6f 66 20 |and suff|ixes of |
|00005700| 65 61 63 68 20 6f 62 6a | 65 63 74 2e 20 2a 2f 0d |each obj|ect. */.|
|00005710| 0d 73 74 61 74 69 63 20 | 76 6f 69 64 0d 66 69 6e |.static |void.fin|
|00005720| 64 5f 69 64 65 6e 74 69 | 63 61 6c 5f 65 6e 64 73 |d_identi|cal_ends|
|00005730| 20 28 72 65 67 69 73 74 | 65 72 20 73 74 72 75 63 | (regist|er struc|
|00005740| 74 20 66 69 6c 65 5f 64 | 61 74 61 20 2a 66 69 6c |t file_d|ata *fil|
|00005750| 65 30 50 74 72 2c 20 72 | 65 67 69 73 74 65 72 20 |e0Ptr, r|egister |
|00005760| 73 74 72 75 63 74 20 66 | 69 6c 65 5f 64 61 74 61 |struct f|ile_data|
|00005770| 20 2a 66 69 6c 65 31 50 | 74 72 29 0d 7b 0d 09 63 | *file1P|tr).{..c|
|00005780| 68 61 72 09 09 09 09 09 | 09 09 09 20 2a 62 65 67 |har.....|... *beg|
|00005790| 30 3b 0d 09 63 68 61 72 | 09 09 09 09 09 09 09 09 |0;..char|........|
|000057a0| 20 2a 65 6e 64 30 3b 0d | 09 69 6e 74 20 09 09 09 | *end0;.|.int ...|
|000057b0| 09 09 09 09 09 09 6c 69 | 6e 65 73 3b 0d 09 72 65 |......li|nes;..re|
|000057c0| 67 69 73 74 65 72 20 63 | 68 61 72 20 09 09 09 20 |gister c|har ... |
|000057d0| 2a 70 30 3b 0d 09 72 65 | 67 69 73 74 65 72 20 63 |*p0;..re|gister c|
|000057e0| 68 61 72 20 09 09 09 20 | 2a 70 31 3b 0d 0d 09 69 |har ... |*p1;...i|
|000057f0| 66 20 28 66 69 6c 65 30 | 50 74 72 2d 3e 62 75 66 |f (file0|Ptr->buf|
|00005800| 66 65 72 65 64 5f 63 68 | 61 72 73 20 3d 3d 20 30 |fered_ch|ars == 0|
|00005810| 20 7c 7c 20 66 69 6c 65 | 31 50 74 72 2d 3e 62 75 | || file|1Ptr->bu|
|00005820| 66 66 65 72 65 64 5f 63 | 68 61 72 73 20 3d 3d 20 |ffered_c|hars == |
|00005830| 30 29 0d 09 09 7b 0d 09 | 09 09 66 69 6c 65 30 50 |0)...{..|..file0P|
|00005840| 74 72 2d 3e 70 72 65 66 | 69 78 5f 65 6e 64 20 3d |tr->pref|ix_end =|
|00005850| 20 66 69 6c 65 30 50 74 | 72 2d 3e 62 75 66 66 65 | file0Pt|r->buffe|
|00005860| 72 3b 0d 09 09 09 66 69 | 6c 65 31 50 74 72 2d 3e |r;....fi|le1Ptr->|
|00005870| 70 72 65 66 69 78 5f 65 | 6e 64 20 3d 20 66 69 6c |prefix_e|nd = fil|
|00005880| 65 31 50 74 72 2d 3e 62 | 75 66 66 65 72 3b 0d 09 |e1Ptr->b|uffer;..|
|00005890| 09 09 66 69 6c 65 30 50 | 74 72 2d 3e 70 72 65 66 |..file0P|tr->pref|
|000058a0| 69 78 5f 6c 69 6e 65 73 | 20 3d 20 66 69 6c 65 31 |ix_lines| = file1|
|000058b0| 50 74 72 2d 3e 70 72 65 | 66 69 78 5f 6c 69 6e 65 |Ptr->pre|fix_line|
|000058c0| 73 20 3d 20 30 3b 0d 09 | 09 09 66 69 6c 65 30 50 |s = 0;..|..file0P|
|000058d0| 74 72 2d 3e 73 75 66 66 | 69 78 5f 62 65 67 69 6e |tr->suff|ix_begin|
|000058e0| 20 3d 20 66 69 6c 65 30 | 50 74 72 2d 3e 62 75 66 | = file0|Ptr->buf|
|000058f0| 66 65 72 20 2b 20 66 69 | 6c 65 30 50 74 72 2d 3e |fer + fi|le0Ptr->|
|00005900| 62 75 66 66 65 72 65 64 | 5f 63 68 61 72 73 3b 0d |buffered|_chars;.|
|00005910| 09 09 09 66 69 6c 65 31 | 50 74 72 2d 3e 73 75 66 |...file1|Ptr->suf|
|00005920| 66 69 78 5f 62 65 67 69 | 6e 20 3d 20 66 69 6c 65 |fix_begi|n = file|
|00005930| 31 50 74 72 2d 3e 62 75 | 66 66 65 72 20 2b 20 66 |1Ptr->bu|ffer + f|
|00005940| 69 6c 65 31 50 74 72 2d | 3e 62 75 66 66 65 72 65 |ile1Ptr-|>buffere|
|00005950| 64 5f 63 68 61 72 73 3b | 0d 09 09 09 66 69 6c 65 |d_chars;|....file|
|00005960| 30 50 74 72 2d 3e 73 75 | 66 66 69 78 5f 6c 69 6e |0Ptr->su|ffix_lin|
|00005970| 65 73 20 3d 20 66 69 6c | 65 31 50 74 72 2d 3e 73 |es = fil|e1Ptr->s|
|00005980| 75 66 66 69 78 5f 6c 69 | 6e 65 73 20 3d 20 30 3b |uffix_li|nes = 0;|
|00005990| 0d 09 09 09 72 65 74 75 | 72 6e 3b 0d 09 09 7d 0d |....retu|rn;...}.|
|000059a0| 0d 09 2f 2a 20 46 69 6e | 64 20 69 64 65 6e 74 69 |../* Fin|d identi|
|000059b0| 63 61 6c 20 70 72 65 66 | 69 78 2e 20 20 2a 2f 0d |cal pref|ix. */.|
|000059c0| 0d 09 70 30 20 3d 20 66 | 69 6c 65 30 50 74 72 2d |..p0 = f|ile0Ptr-|
|000059d0| 3e 62 75 66 66 65 72 3b | 0d 09 70 31 20 3d 20 66 |>buffer;|..p1 = f|
|000059e0| 69 6c 65 31 50 74 72 2d | 3e 62 75 66 66 65 72 3b |ile1Ptr-|>buffer;|
|000059f0| 0d 09 6c 69 6e 65 73 20 | 3d 20 30 3b 0d 0d 09 2f |..lines |= 0;.../|
|00005a00| 2a 20 49 6e 73 65 72 74 | 20 65 6e 64 20 22 73 65 |* Insert| end "se|
|00005a10| 6e 74 69 6e 65 6c 73 22 | 2c 20 69 6e 20 74 68 69 |ntinels"|, in thi|
|00005a20| 73 20 63 61 73 65 20 63 | 68 61 72 61 63 74 65 72 |s case c|haracter|
|00005a30| 73 20 74 68 61 74 20 61 | 72 65 20 67 75 61 72 61 |s that a|re guara|
|00005a40| 6e 74 65 65 64 0d 09 09 | 20 74 6f 20 6d 61 6b 65 |nteed...| to make|
|00005a50| 20 74 68 65 20 65 71 75 | 61 6c 69 74 79 20 74 65 | the equ|ality te|
|00005a60| 73 74 20 66 61 6c 73 65 | 2c 20 61 6e 64 20 74 68 |st false|, and th|
|00005a70| 75 73 20 74 65 72 6d 69 | 6e 61 74 65 20 74 68 65 |us termi|nate the|
|00005a80| 20 6c 6f 6f 70 2e 09 2a | 2f 0d 0d 09 69 66 20 28 | loop..*|/...if (|
|00005a90| 66 69 6c 65 30 50 74 72 | 2d 3e 62 75 66 66 65 72 |file0Ptr|->buffer|
|00005aa0| 65 64 5f 63 68 61 72 73 | 20 3c 20 66 69 6c 65 31 |ed_chars| < file1|
|00005ab0| 50 74 72 2d 3e 62 75 66 | 66 65 72 65 64 5f 63 68 |Ptr->buf|fered_ch|
|00005ac0| 61 72 73 29 0d 09 09 70 | 30 5b 66 69 6c 65 30 50 |ars)...p|0[file0P|
|00005ad0| 74 72 2d 3e 62 75 66 66 | 65 72 65 64 5f 63 68 61 |tr->buff|ered_cha|
|00005ae0| 72 73 5d 20 3d 20 28 63 | 68 61 72 29 20 7e 70 31 |rs] = (c|har) ~p1|
|00005af0| 5b 66 69 6c 65 30 50 74 | 72 2d 3e 62 75 66 66 65 |[file0Pt|r->buffe|
|00005b00| 72 65 64 5f 63 68 61 72 | 73 5d 3b 0d 09 65 6c 73 |red_char|s];..els|
|00005b10| 65 0d 09 09 70 31 5b 66 | 69 6c 65 31 50 74 72 2d |e...p1[f|ile1Ptr-|
|00005b20| 3e 62 75 66 66 65 72 65 | 64 5f 63 68 61 72 73 5d |>buffere|d_chars]|
|00005b30| 20 3d 20 28 63 68 61 72 | 29 20 7e 70 30 5b 66 69 | = (char|) ~p0[fi|
|00005b40| 6c 65 31 50 74 72 2d 3e | 62 75 66 66 65 72 65 64 |le1Ptr->|buffered|
|00005b50| 5f 63 68 61 72 73 5d 3b | 0d 0d 09 2f 2a 20 4c 6f |_chars];|.../* Lo|
|00005b60| 6f 70 20 75 6e 74 69 6c | 20 66 69 72 73 74 20 6d |op until| first m|
|00005b70| 69 73 6d 61 74 63 68 2c | 20 6f 72 20 74 6f 20 74 |ismatch,| or to t|
|00005b80| 68 65 20 73 65 6e 74 69 | 6e 65 6c 20 63 68 61 72 |he senti|nel char|
|00005b90| 61 63 74 65 72 73 2e 09 | 2a 2f 0d 09 77 68 69 6c |acters..|*/..whil|
|00005ba0| 65 20 28 31 29 0d 09 09 | 7b 0d 09 09 09 63 68 61 |e (1)...|{....cha|
|00005bb0| 72 20 63 20 3d 20 2a 70 | 30 2b 2b 3b 0d 09 09 09 |r c = *p|0++;....|
|00005bc0| 69 66 20 28 63 20 21 3d | 20 2a 70 31 2b 2b 29 0d |if (c !=| *p1++).|
|00005bd0| 09 09 09 09 62 72 65 61 | 6b 3b 0d 09 09 09 69 66 |....brea|k;....if|
|00005be0| 20 28 63 20 3d 3d 20 27 | 5c 6e 27 29 0d 09 09 09 | (c == '|\n')....|
|00005bf0| 09 2b 2b 6c 69 6e 65 73 | 3b 0d 09 09 7d 0d 0d 09 |.++lines|;...}...|
|00005c00| 2f 2a 20 44 6f 6e 27 74 | 20 63 6f 75 6e 74 20 6d |/* Don't| count m|
|00005c10| 69 73 73 69 6e 67 20 6e | 65 77 6c 69 6e 65 20 61 |issing n|ewline a|
|00005c20| 73 20 70 61 72 74 20 6f | 66 20 70 72 65 66 69 78 |s part o|f prefix|
|00005c30| 2e 20 2a 2f 0d 09 69 66 | 20 28 20 28 66 69 6c 65 |. */..if| ( (file|
|00005c40| 30 50 74 72 2d 3e 6d 69 | 73 73 69 6e 67 5f 6e 65 |0Ptr->mi|ssing_ne|
|00005c50| 77 6c 69 6e 65 20 26 26 | 20 28 75 6e 73 69 67 6e |wline &&| (unsign|
|00005c60| 65 64 20 69 6e 74 29 20 | 28 70 30 20 2d 20 66 69 |ed int) |(p0 - fi|
|00005c70| 6c 65 30 50 74 72 2d 3e | 62 75 66 66 65 72 29 20 |le0Ptr->|buffer) |
|00005c80| 3e 20 66 69 6c 65 30 50 | 74 72 2d 3e 62 75 66 66 |> file0P|tr->buff|
|00005c90| 65 72 65 64 5f 63 68 61 | 72 73 29 20 7c 7c 0d 09 |ered_cha|rs) ||..|
|00005ca0| 09 09 20 28 66 69 6c 65 | 31 50 74 72 2d 3e 6d 69 |.. (file|1Ptr->mi|
|00005cb0| 73 73 69 6e 67 5f 6e 65 | 77 6c 69 6e 65 20 26 26 |ssing_ne|wline &&|
|00005cc0| 20 28 75 6e 73 69 67 6e | 65 64 20 69 6e 74 29 20 | (unsign|ed int) |
|00005cd0| 28 70 31 20 2d 20 66 69 | 6c 65 31 50 74 72 2d 3e |(p1 - fi|le1Ptr->|
|00005ce0| 62 75 66 66 65 72 29 20 | 3e 20 66 69 6c 65 31 50 |buffer) |> file1P|
|00005cf0| 74 72 2d 3e 62 75 66 66 | 65 72 65 64 5f 63 68 61 |tr->buff|ered_cha|
|00005d00| 72 73 29 20 29 0d 09 09 | 2d 2d 70 30 2c 20 2d 2d |rs) )...|--p0, --|
|00005d10| 70 31 2c 20 2d 2d 6c 69 | 6e 65 73 3b 0d 0d 09 2f |p1, --li|nes;.../|
|00005d20| 2a 20 49 66 20 74 68 65 | 20 73 65 6e 74 69 6e 65 |* If the| sentine|
|00005d30| 6c 20 77 61 73 20 70 61 | 73 73 65 64 2c 20 61 6e |l was pa|ssed, an|
|00005d40| 64 20 6c 65 6e 67 74 68 | 73 20 61 72 65 20 65 71 |d length|s are eq|
|00005d50| 75 61 6c 2c 20 74 68 65 | 0d 09 09 20 66 69 6c 65 |ual, the|... file|
|00005d60| 73 20 61 72 65 20 69 64 | 65 6e 74 69 63 61 6c 2e |s are id|entical.|
|00005d70| 20 2a 2f 0d 0d 09 69 66 | 20 28 28 75 6e 73 69 67 | */...if| ((unsig|
|00005d80| 6e 65 64 20 69 6e 74 29 | 20 28 70 30 20 2d 20 66 |ned int)| (p0 - f|
|00005d90| 69 6c 65 30 50 74 72 2d | 3e 62 75 66 66 65 72 29 |ile0Ptr-|>buffer)|
|00005da0| 20 3e 20 66 69 6c 65 30 | 50 74 72 2d 3e 62 75 66 | > file0|Ptr->buf|
|00005db0| 66 65 72 65 64 5f 63 68 | 61 72 73 0d 09 09 09 26 |fered_ch|ars....&|
|00005dc0| 26 20 66 69 6c 65 30 50 | 74 72 2d 3e 62 75 66 66 |& file0P|tr->buff|
|00005dd0| 65 72 65 64 5f 63 68 61 | 72 73 20 3d 3d 20 66 69 |ered_cha|rs == fi|
|00005de0| 6c 65 31 50 74 72 2d 3e | 62 75 66 66 65 72 65 64 |le1Ptr->|buffered|
|00005df0| 5f 63 68 61 72 73 29 0d | 09 09 7b 0d 09 09 09 66 |_chars).|..{....f|
|00005e00| 69 6c 65 30 50 74 72 2d | 3e 70 72 65 66 69 78 5f |ile0Ptr-|>prefix_|
|00005e10| 65 6e 64 20 3d 20 70 30 | 20 2d 20 31 3b 0d 09 09 |end = p0| - 1;...|
|00005e20| 09 66 69 6c 65 31 50 74 | 72 2d 3e 70 72 65 66 69 |.file1Pt|r->prefi|
|00005e30| 78 5f 65 6e 64 20 3d 20 | 70 31 20 2d 20 31 3b 0d |x_end = |p1 - 1;.|
|00005e40| 09 09 09 66 69 6c 65 30 | 50 74 72 2d 3e 70 72 65 |...file0|Ptr->pre|
|00005e50| 66 69 78 5f 6c 69 6e 65 | 73 20 3d 20 66 69 6c 65 |fix_line|s = file|
|00005e60| 31 50 74 72 2d 3e 70 72 | 65 66 69 78 5f 6c 69 6e |1Ptr->pr|efix_lin|
|00005e70| 65 73 20 3d 20 6c 69 6e | 65 73 3b 0d 09 09 09 66 |es = lin|es;....f|
|00005e80| 69 6c 65 30 50 74 72 2d | 3e 73 75 66 66 69 78 5f |ile0Ptr-|>suffix_|
|00005e90| 62 65 67 69 6e 20 3d 20 | 66 69 6c 65 30 50 74 72 |begin = |file0Ptr|
|00005ea0| 2d 3e 62 75 66 66 65 72 | 3b 0d 09 09 09 66 69 6c |->buffer|;....fil|
|00005eb0| 65 31 50 74 72 2d 3e 73 | 75 66 66 69 78 5f 62 65 |e1Ptr->s|uffix_be|
|00005ec0| 67 69 6e 20 3d 20 66 69 | 6c 65 31 50 74 72 2d 3e |gin = fi|le1Ptr->|
|00005ed0| 62 75 66 66 65 72 3b 0d | 09 09 09 66 69 6c 65 30 |buffer;.|...file0|
|00005ee0| 50 74 72 2d 3e 73 75 66 | 66 69 78 5f 6c 69 6e 65 |Ptr->suf|fix_line|
|00005ef0| 73 20 3d 20 66 69 6c 65 | 31 50 74 72 2d 3e 73 75 |s = file|1Ptr->su|
|00005f00| 66 66 69 78 5f 6c 69 6e | 65 73 20 3d 20 6c 69 6e |ffix_lin|es = lin|
|00005f10| 65 73 3b 0d 09 09 09 72 | 65 74 75 72 6e 3b 0d 09 |es;....r|eturn;..|
|00005f20| 09 7d 0d 0d 09 2f 2a 20 | 50 6f 69 6e 74 20 61 74 |.}.../* |Point at|
|00005f30| 20 66 69 72 73 74 20 6e | 6f 6e 6d 61 74 63 68 69 | first n|onmatchi|
|00005f40| 6e 67 20 63 68 61 72 61 | 63 74 65 72 73 2e 20 20 |ng chara|cters. |
|00005f50| 2a 2f 0d 09 2d 2d 70 30 | 2c 20 2d 2d 70 31 3b 0d |*/..--p0|, --p1;.|
|00005f60| 0d 09 2f 2a 20 53 6b 69 | 70 20 62 61 63 6b 20 74 |../* Ski|p back t|
|00005f70| 6f 20 6c 61 73 74 20 6c | 69 6e 65 2d 62 65 67 69 |o last l|ine-begi|
|00005f80| 6e 6e 69 6e 67 20 69 6e | 20 74 68 65 20 70 72 65 |nning in| the pre|
|00005f90| 66 69 78 2e 09 2a 2f 0d | 09 77 68 69 6c 65 20 28 |fix..*/.|.while (|
|00005fa0| 70 30 20 21 3d 20 66 69 | 6c 65 30 50 74 72 2d 3e |p0 != fi|le0Ptr->|
|00005fb0| 62 75 66 66 65 72 20 26 | 26 20 70 30 5b 2d 31 5d |buffer &|& p0[-1]|
|00005fc0| 20 21 3d 20 27 5c 6e 27 | 29 0d 09 09 2d 2d 70 30 | != '\n'|)...--p0|
|00005fd0| 2c 20 2d 2d 70 31 3b 0d | 0d 09 2f 2a 20 52 65 63 |, --p1;.|../* Rec|
|00005fe0| 6f 72 64 20 74 68 65 20 | 70 72 65 66 69 78 2e 20 |ord the |prefix. |
|00005ff0| 20 2a 2f 0d 09 66 69 6c | 65 30 50 74 72 2d 3e 70 | */..fil|e0Ptr->p|
|00006000| 72 65 66 69 78 5f 65 6e | 64 20 3d 20 70 30 3b 0d |refix_en|d = p0;.|
|00006010| 09 66 69 6c 65 31 50 74 | 72 2d 3e 70 72 65 66 69 |.file1Pt|r->prefi|
|00006020| 78 5f 65 6e 64 20 3d 20 | 70 31 3b 0d 09 66 69 6c |x_end = |p1;..fil|
|00006030| 65 30 50 74 72 2d 3e 70 | 72 65 66 69 78 5f 6c 69 |e0Ptr->p|refix_li|
|00006040| 6e 65 73 20 3d 20 66 69 | 6c 65 31 50 74 72 2d 3e |nes = fi|le1Ptr->|
|00006050| 70 72 65 66 69 78 5f 6c | 69 6e 65 73 20 3d 20 6c |prefix_l|ines = l|
|00006060| 69 6e 65 73 3b 0d 09 0d | 09 2f 2a 20 46 69 6e 64 |ines;...|./* Find|
|00006070| 20 69 64 65 6e 74 69 63 | 61 6c 20 73 75 66 66 69 | identic|al suffi|
|00006080| 78 2e 20 20 2a 2f 0d 0d | 09 2f 2a 20 50 30 20 61 |x. */..|./* P0 a|
|00006090| 6e 64 20 50 31 20 70 6f | 69 6e 74 20 62 65 79 6f |nd P1 po|int beyo|
|000060a0| 6e 64 20 74 68 65 20 6c | 61 73 74 20 63 68 61 72 |nd the l|ast char|
|000060b0| 73 20 6e 6f 74 20 79 65 | 74 20 63 6f 6d 70 61 72 |s not ye|t compar|
|000060c0| 65 64 2e 09 2a 2f 0d 09 | 70 30 20 3d 20 66 69 6c |ed..*/..|p0 = fil|
|000060d0| 65 30 50 74 72 2d 3e 62 | 75 66 66 65 72 20 2b 20 |e0Ptr->b|uffer + |
|000060e0| 66 69 6c 65 30 50 74 72 | 2d 3e 62 75 66 66 65 72 |file0Ptr|->buffer|
|000060f0| 65 64 5f 63 68 61 72 73 | 3b 0d 09 70 31 20 3d 20 |ed_chars|;..p1 = |
|00006100| 66 69 6c 65 31 50 74 72 | 2d 3e 62 75 66 66 65 72 |file1Ptr|->buffer|
|00006110| 20 2b 20 66 69 6c 65 31 | 50 74 72 2d 3e 62 75 66 | + file1|Ptr->buf|
|00006120| 66 65 72 65 64 5f 63 68 | 61 72 73 3b 0d 09 6c 69 |fered_ch|ars;..li|
|00006130| 6e 65 73 20 3d 20 30 3b | 0d 0d 09 69 66 20 28 66 |nes = 0;|...if (f|
|00006140| 69 6c 65 30 50 74 72 2d | 3e 6d 69 73 73 69 6e 67 |ile0Ptr-|>missing|
|00006150| 5f 6e 65 77 6c 69 6e 65 | 20 3d 3d 20 66 69 6c 65 |_newline| == file|
|00006160| 31 50 74 72 2d 3e 6d 69 | 73 73 69 6e 67 5f 6e 65 |1Ptr->mi|ssing_ne|
|00006170| 77 6c 69 6e 65 29 0d 09 | 09 7b 0d 09 09 09 65 6e |wline)..|.{....en|
|00006180| 64 30 20 3d 20 70 30 3b | 09 09 09 09 09 09 09 09 |d0 = p0;|........|
|00006190| 2f 2a 20 41 64 64 72 20 | 6f 66 20 6c 61 73 74 20 |/* Addr |of last |
|000061a0| 63 68 61 72 20 69 6e 20 | 66 69 6c 65 20 30 2e 20 |char in |file 0. |
|000061b0| 20 2a 2f 0d 0d 09 09 09 | 2f 2a 20 47 65 74 20 76 | */.....|/* Get v|
|000061c0| 61 6c 75 65 20 6f 66 20 | 50 30 20 61 74 20 77 68 |alue of |P0 at wh|
|000061d0| 69 63 68 20 77 65 20 73 | 68 6f 75 6c 64 20 73 74 |ich we s|hould st|
|000061e0| 6f 70 20 73 63 61 6e 6e | 69 6e 67 20 62 61 63 6b |op scann|ing back|
|000061f0| 77 61 72 64 3a 0d 09 09 | 09 09 20 74 68 69 73 20 |ward:...|.. this |
|00006200| 69 73 20 77 68 65 6e 20 | 65 69 74 68 65 72 20 50 |is when |either P|
|00006210| 30 20 6f 72 20 50 31 20 | 70 6f 69 6e 74 73 20 6a |0 or P1 |points j|
|00006220| 75 73 74 20 70 61 73 74 | 20 74 68 65 20 6c 61 73 |ust past| the las|
|00006230| 74 20 63 68 61 72 0d 09 | 09 09 09 20 6f 66 20 74 |t char..|... of t|
|00006240| 68 65 20 69 64 65 6e 74 | 69 63 61 6c 20 70 72 65 |he ident|ical pre|
|00006250| 66 69 78 2e 20 20 2a 2f | 0d 09 09 09 69 66 20 28 |fix. */|....if (|
|00006260| 66 69 6c 65 30 50 74 72 | 2d 3e 62 75 66 66 65 72 |file0Ptr|->buffer|
|00006270| 65 64 5f 63 68 61 72 73 | 20 3c 20 66 69 6c 65 31 |ed_chars| < file1|
|00006280| 50 74 72 2d 3e 62 75 66 | 66 65 72 65 64 5f 63 68 |Ptr->buf|fered_ch|
|00006290| 61 72 73 29 0d 09 09 09 | 09 62 65 67 30 20 3d 20 |ars)....|.beg0 = |
|000062a0| 66 69 6c 65 30 50 74 72 | 2d 3e 70 72 65 66 69 78 |file0Ptr|->prefix|
|000062b0| 5f 65 6e 64 3b 0d 09 09 | 09 65 6c 73 65 0d 09 09 |_end;...|.else...|
|000062c0| 09 09 2f 2a 20 46 69 67 | 75 72 65 20 6f 75 74 20 |../* Fig|ure out |
|000062d0| 77 68 65 72 65 20 50 30 | 20 77 69 6c 6c 20 62 65 |where P0| will be|
|000062e0| 20 77 68 65 6e 20 50 31 | 20 69 73 20 61 74 20 74 | when P1| is at t|
|000062f0| 68 65 20 65 6e 64 20 6f | 66 20 74 68 65 20 70 72 |he end o|f the pr|
|00006300| 65 66 69 78 2e 0d 09 09 | 09 09 09 20 54 68 75 73 |efix....|... Thus|
|00006310| 20 77 65 20 6f 6e 6c 79 | 20 6e 65 65 64 20 74 6f | we only| need to|
|00006320| 20 74 65 73 74 20 50 30 | 2e 09 2a 2f 0d 09 09 09 | test P0|..*/....|
|00006330| 09 62 65 67 30 20 3d 20 | 28 66 69 6c 65 30 50 74 |.beg0 = |(file0Pt|
|00006340| 72 2d 3e 70 72 65 66 69 | 78 5f 65 6e 64 20 2b 20 |r->prefi|x_end + |
|00006350| 66 69 6c 65 30 50 74 72 | 2d 3e 62 75 66 66 65 72 |file0Ptr|->buffer|
|00006360| 65 64 5f 63 68 61 72 73 | 20 2d 20 66 69 6c 65 31 |ed_chars| - file1|
|00006370| 50 74 72 2d 3e 62 75 66 | 66 65 72 65 64 5f 63 68 |Ptr->buf|fered_ch|
|00006380| 61 72 73 29 3b 0d 0d 09 | 09 09 2f 2a 20 53 63 61 |ars);...|../* Sca|
|00006390| 6e 20 62 61 63 6b 20 75 | 6e 74 69 6c 20 63 68 61 |n back u|ntil cha|
|000063a0| 72 73 20 64 6f 6e 27 74 | 20 6d 61 74 63 68 20 6f |rs don't| match o|
|000063b0| 72 20 77 65 20 72 65 61 | 63 68 20 74 68 61 74 20 |r we rea|ch that |
|000063c0| 70 6f 69 6e 74 2e 20 20 | 2a 2f 0d 09 09 09 77 68 |point. |*/....wh|
|000063d0| 69 6c 65 20 28 70 30 20 | 21 3d 20 62 65 67 30 29 |ile (p0 |!= beg0)|
|000063e0| 0d 09 09 09 09 7b 0d 09 | 09 09 09 09 63 68 61 72 |.....{..|....char|
|000063f0| 20 63 20 3d 20 2a 2d 2d | 70 30 3b 0d 09 09 09 09 | c = *--|p0;.....|
+--------+-------------------------+-------------------------+--------+--------+
Only 25.0 KB of data is shown above.